parent
4af72b6acd
commit
ab0715d886
@ -0,0 +1,14 @@ |
||||
module.exports = { |
||||
stories: ['../src/features/**/stories.(tsx)'], |
||||
addons: [ |
||||
'@storybook/addon-actions', |
||||
'@storybook/addon-links', |
||||
'@storybook/preset-create-react-app', |
||||
{ |
||||
name: "@storybook/addon-docs", |
||||
options: { |
||||
configureJSX: true, |
||||
}, |
||||
}, |
||||
], |
||||
}; |
||||
@ -0,0 +1,19 @@ |
||||
import React, { ReactNode } from 'react' |
||||
|
||||
type ButtonProps = { |
||||
children: ReactNode, |
||||
|
||||
/** |
||||
* Simple click handler |
||||
*/ |
||||
onClick?: () => void, |
||||
} |
||||
|
||||
/** |
||||
* The world's most _basic_ button |
||||
*/ |
||||
export const Button = ({ children, onClick }: ButtonProps) => ( |
||||
<button onClick={onClick} type='button'> |
||||
{children} |
||||
</button> |
||||
) |
||||
@ -0,0 +1,20 @@ |
||||
import React from 'react' |
||||
|
||||
import { action } from '@storybook/addon-actions' |
||||
|
||||
import { Button } from 'features/Button' |
||||
|
||||
export default { |
||||
component: Button, |
||||
title: 'Button', |
||||
} |
||||
|
||||
export const Text = () => <Button onClick={action('clicked')}>Hello Button</Button> |
||||
|
||||
export const Emoji = () => ( |
||||
<Button onClick={action('clicked')}> |
||||
<span role='img' aria-label='so cool'> |
||||
😀 😎 👍 💯 |
||||
</span> |
||||
</Button> |
||||
) |
||||
Loading…
Reference in new issue