-
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.
Notice: Remove knobs in stories (#46956)
- Loading branch information
Showing
1 changed file
with
30 additions
and
58 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 |
---|---|---|
@@ -1,74 +1,46 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { boolean, select, text } from '@storybook/addon-knobs'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import Notice from '../'; | ||
|
||
// TODO: Add a story involving NoticeList to help people understand | ||
// the difference between onDismiss/onRemove. | ||
|
||
export default { | ||
title: 'Components/Notice', | ||
component: Notice, | ||
argTypes: { | ||
isDismissible: { control: 'boolean' }, | ||
onDismiss: { control: { type: null } }, | ||
onRemove: { control: { type: null } }, | ||
politeness: { | ||
control: 'radio', | ||
options: [ 'assertive', 'polite' ], | ||
}, | ||
spokenMessage: { control: 'text' }, | ||
status: { | ||
control: 'radio', | ||
options: [ 'warning', 'success', 'error', 'info' ], | ||
}, | ||
}, | ||
parameters: { | ||
knobs: { disable: false }, | ||
controls: { expanded: true }, | ||
docs: { source: { state: 'open' } }, | ||
}, | ||
}; | ||
|
||
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> | ||
); | ||
const Template = ( props ) => { | ||
return <Notice { ...props } />; | ||
}; | ||
|
||
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' | ||
); | ||
export const Default = Template.bind( {} ); | ||
Default.args = { | ||
children: 'This is a notice.', | ||
}; | ||
|
||
return ( | ||
<Notice | ||
status={ status } | ||
isDismissible={ isDismissible } | ||
politeness={ politeness } | ||
spokenMessage={ spokenMessage } | ||
> | ||
<p>This is a notice.</p> | ||
</Notice> | ||
); | ||
export const WithCustomSpokenMessage = Template.bind( {} ); | ||
WithCustomSpokenMessage.args = { | ||
...Default.args, | ||
politeness: 'assertive', | ||
spokenMessage: 'This is a notice with a custom spoken message', | ||
}; |
f14c2ee
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flaky tests detected in f14c2ee.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3881320947
📝 Reported issues:
specs/editor/various/block-editor-keyboard-shortcuts.test.js