-
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.
Add storybook story for Notice component
- Loading branch information
1 parent
85d8a2a
commit 533d43b
Showing
1 changed file
with
71 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { boolean, select, text } from '@storybook/addon-knobs'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import Notice from '../'; | ||
|
||
export default { | ||
title: 'Components/Notice', | ||
component: Notice, | ||
}; | ||
|
||
export const _default = () => { | ||
const status = select( | ||
'Status', | ||
{ | ||
Warning: 'warning', | ||
Success: 'success', | ||
Error: 'error', | ||
Info: 'info', | ||
}, | ||
'info' | ||
); | ||
const isDismissible = boolean( 'Is Dismissible', true ); | ||
|
||
return ( | ||
<Notice status={ status } isDismissible={ isDismissible }> | ||
<p>This is a notice.</p> | ||
</Notice> | ||
); | ||
}; | ||
|
||
export const withCustomSpokenMessage = () => { | ||
const status = select( | ||
'Status', | ||
{ | ||
Warning: 'warning', | ||
Success: 'success', | ||
Error: 'error', | ||
Info: 'info', | ||
}, | ||
'info' | ||
); | ||
const isDismissible = boolean( 'Is Dismissible', true ); | ||
const politeness = select( | ||
'Politeness', | ||
{ | ||
Assertive: 'assertive', | ||
Polite: 'polite', | ||
}, | ||
'assertive' | ||
); | ||
const spokenMessage = text( | ||
'Spoken Message', | ||
'This is a notice with a custom spoken message' | ||
); | ||
|
||
return ( | ||
<Notice | ||
status={ status } | ||
isDismissible={ isDismissible } | ||
politeness={ politeness } | ||
spokenMessage={ spokenMessage } | ||
> | ||
<p>This is a notice.</p> | ||
</Notice> | ||
); | ||
}; |