-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Storybook: Apply a set of enhancements to the existing stories (#18030)
* Storybook: Apply a set of enhancements to the existing stories * Add basic knobs integration to all Button stories
- Loading branch information
Showing
7 changed files
with
150 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,87 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { text } from '@storybook/addon-knobs'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import Button from '../'; | ||
|
||
export default { title: 'Button', component: Button }; | ||
|
||
export const _default = () => <Button>Hello Button</Button>; | ||
export const _default = () => { | ||
const label = text( 'Label', 'Default Button' ); | ||
|
||
return ( | ||
<Button>{ label }</Button> | ||
); | ||
}; | ||
|
||
export const primary = () => { | ||
const label = text( 'Label', 'Primary Button' ); | ||
|
||
return ( | ||
<Button isPrimary>{ label }</Button> | ||
); | ||
}; | ||
|
||
export const large = () => { | ||
const label = text( 'Label', 'Large Button' ); | ||
|
||
return ( | ||
<Button isLarge>{ label }</Button> | ||
); | ||
}; | ||
|
||
export const largePrimary = () => { | ||
const label = text( 'Label', 'Large Primary Button' ); | ||
|
||
return ( | ||
<Button isPrimary isLarge>{ label }</Button> | ||
); | ||
}; | ||
|
||
export const small = () => { | ||
const label = text( 'Label', 'Small Button' ); | ||
|
||
return ( | ||
<Button isSmall>{ label }</Button> | ||
); | ||
}; | ||
|
||
export const primary = () => <Button isPrimary>Hello Button</Button>; | ||
export const toggled = () => { | ||
const label = text( 'Label', 'Toggled Button' ); | ||
|
||
export const large = () => <Button isLarge>Hello Button</Button>; | ||
return ( | ||
<Button isToggled>{ label }</Button> | ||
); | ||
}; | ||
|
||
export const largePrimary = () => ( | ||
<Button isPrimary isLarge> | ||
Hello Button | ||
</Button> | ||
); | ||
export const disabled = () => { | ||
const label = text( 'Label', 'Disabled Button' ); | ||
|
||
export const small = () => <Button isSmall>Hello Button</Button>; | ||
return ( | ||
<Button disabled>{ label }</Button> | ||
); | ||
}; | ||
|
||
export const toggled = () => <Button isToggled>Hello Button</Button>; | ||
export const link = () => { | ||
const label = text( 'Label', 'Link Button' ); | ||
|
||
export const disabled = () => <Button disabled>Hello Button</Button>; | ||
return ( | ||
<Button href="https://wordpress.org/" target="_blank"> | ||
{ label } | ||
</Button> | ||
); | ||
}; | ||
|
||
export const link = () => ( | ||
<Button href="https://wordpress.org/" target="_blank"> | ||
Hello Button | ||
</Button> | ||
); | ||
export const disabledLink = () => { | ||
const label = text( 'Label', 'Disabled Link Button' ); | ||
|
||
export const disabledLink = () => ( | ||
<Button href="https://wordpress.org/" target="_blank" disabled> | ||
Hello Button | ||
</Button> | ||
); | ||
return ( | ||
<Button href="https://wordpress.org/" target="_blank" disabled> | ||
{ label } | ||
</Button> | ||
); | ||
}; |
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
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