Skip to content

Commit

Permalink
Notice: Remove knobs in stories (#46956)
Browse files Browse the repository at this point in the history
  • Loading branch information
mirka authored Jan 10, 2023
1 parent 6c7c672 commit f14c2ee
Showing 1 changed file with 30 additions and 58 deletions.
88 changes: 30 additions & 58 deletions packages/components/src/notice/stories/index.js
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',
};

1 comment on commit f14c2ee

@github-actions
Copy link

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:

Please sign in to comment.