-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introduce storybook for Link and Button
- Loading branch information
Andrei Fidelman
committed
Oct 29, 2020
1 parent
b036b59
commit 27a9ca3
Showing
11 changed files
with
141 additions
and
139 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 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 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,60 @@ | ||
import React from 'react' | ||
// also exported from '@storybook/react' if you can deal with breaking changes in 6.1 | ||
import { Story, Meta } from '@storybook/react' | ||
|
||
import Button, { ButtonProps, ButtonSize } from './' | ||
|
||
const story: Meta = { | ||
title: 'Button', | ||
component: Button, | ||
argTypes: { | ||
disabled: { | ||
control: { | ||
type: 'boolean', | ||
}, | ||
}, | ||
size: { | ||
defaultValue: ButtonSize.Normal, | ||
control: { | ||
type: 'select', | ||
options: [ButtonSize.Normal, ButtonSize.Small], | ||
}, | ||
}, | ||
inverted: { | ||
defaultValue: false, | ||
control: { | ||
type: 'boolean', | ||
}, | ||
}, | ||
onClick: { action: 'click' }, | ||
onFocus: { action: 'focus' }, | ||
onBlur: { action: 'blur' }, | ||
}, | ||
} | ||
|
||
const Template: Story<ButtonProps> = (args: ButtonProps) => <Button {...args} /> | ||
|
||
export const Default = Template.bind({}) | ||
Default.args = { | ||
children: 'Button', | ||
} | ||
|
||
export const Inverted = Template.bind({}) | ||
Inverted.args = { | ||
children: 'Button', | ||
inverted: true, | ||
} | ||
|
||
export const Small = Template.bind({}) | ||
Small.args = { | ||
children: 'Button', | ||
size: ButtonSize.Small, | ||
} | ||
|
||
export const Disabled = Template.bind({}) | ||
Disabled.args = { | ||
children: 'Button', | ||
disabled: true, | ||
} | ||
|
||
export default story |
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 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 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,55 @@ | ||
import React from 'react' | ||
// also exported from '@storybook/react' if you can deal with breaking changes in 6.1 | ||
import { Story, Meta } from '@storybook/react' | ||
|
||
import Link, { LinkProps } from './' | ||
import { ButtonSize } from '../Button' | ||
|
||
const story: Meta = { | ||
title: 'Link', | ||
component: Link, | ||
argTypes: { | ||
href: { | ||
defaultValue: 'https://cesko.digital/', | ||
control: { | ||
type: 'text', | ||
}, | ||
}, | ||
disabled: { | ||
control: { | ||
type: 'boolean', | ||
}, | ||
}, | ||
size: { | ||
defaultValue: ButtonSize.Normal, | ||
control: { | ||
type: 'select', | ||
options: [ButtonSize.Normal, ButtonSize.Small], | ||
}, | ||
}, | ||
onClick: { action: 'click' }, | ||
onFocus: { action: 'focus' }, | ||
onBlur: { action: 'blur' }, | ||
}, | ||
} | ||
|
||
const Template: Story<LinkProps> = (args: LinkProps) => <Link {...args} /> | ||
|
||
export const Default = Template.bind({}) | ||
Default.args = { | ||
children: 'Link', | ||
} | ||
|
||
export const Small = Template.bind({}) | ||
Small.args = { | ||
children: 'Link', | ||
size: ButtonSize.Small, | ||
} | ||
|
||
export const Disabled = Template.bind({}) | ||
Disabled.args = { | ||
children: 'Link', | ||
disabled: true, | ||
} | ||
|
||
export default story |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.