-
Notifications
You must be signed in to change notification settings - Fork 507
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate new Storybook config (#435)
* Add new dependencies for Docs * Update config * Redefine demo component and story
- Loading branch information
1 parent
ce3ff8e
commit 1d8f123
Showing
9 changed files
with
50 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module.exports = { | ||
stories: ['../stories/**/*.stories.(ts|tsx)'], | ||
addons: ['@storybook/addon-actions', '@storybook/addon-links', '@storybook/addon-docs'], | ||
webpackFinal: async (config) => { | ||
config.module.rules.push({ | ||
test: /\.(ts|tsx)$/, | ||
use: [ | ||
{ | ||
loader: require.resolve('ts-loader'), | ||
options: { | ||
transpileOnly: true, | ||
}, | ||
}, | ||
{ | ||
loader: require.resolve('react-docgen-typescript-loader'), | ||
}, | ||
], | ||
}); | ||
|
||
config.resolve.extensions.push('.ts', '.tsx'); | ||
|
||
return config; | ||
}, | ||
}; |
17 changes: 0 additions & 17 deletions
17
templates/react-with-storybook/.storybook/webpack.config.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
import * as React from 'react'; | ||
import React, { FC, HTMLAttributes, ReactChild } from 'react'; | ||
|
||
// Delete me | ||
export const Thing = () => { | ||
return <div>the snozzberries taste like snozzberries</div>; | ||
export interface Props extends HTMLAttributes<HTMLDivElement> { | ||
children?: ReactChild; | ||
} | ||
|
||
// Please do not use types off of a default export module or else Storybook Docs will suffer. | ||
// see: https://github.com/storybookjs/storybook/issues/9556 | ||
export const Thing: FC<Props> = ({ children }) => { | ||
return <div>{children || `the snozzberries taste like snozzberries`}</div>; | ||
}; |
12 changes: 0 additions & 12 deletions
12
templates/react-with-storybook/stories/0-Welcome.stories.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'react'; | ||
import { Thing, Props } from '../src'; | ||
|
||
export default { | ||
title: 'Welcome', | ||
}; | ||
|
||
// By passing optional props to this story, you can control the props of the component when | ||
// you consume the story in a test. | ||
export const Default = (props?: Partial<Props>) => <Thing {...props} />; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters