sforkowany z mirror/soapbox
Add Toast story
rodzic
8bd175e0e4
commit
a893cb72d5
|
@ -142,4 +142,7 @@ const Toast = (props: IToast) => {
|
|||
);
|
||||
};
|
||||
|
||||
export default Toast;
|
||||
export {
|
||||
Toast as default,
|
||||
Toast,
|
||||
};
|
|
@ -0,0 +1,37 @@
|
|||
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
||||
import React from 'react';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
|
||||
import { Toast } from 'soapbox/components/ui';
|
||||
|
||||
export default {
|
||||
title: 'UI/Toast',
|
||||
component: Toast,
|
||||
argTypes: {
|
||||
t: { defaultValue: { visible: true, dismiss: () => {} }, table: { disable: true } },
|
||||
message: { type: 'string', defaultValue: 'Toast' },
|
||||
type: { defaultValue: 'success' },
|
||||
action: { table: { disable: true } },
|
||||
},
|
||||
} as ComponentMeta<typeof Toast>;
|
||||
|
||||
const Template: ComponentStory<typeof Toast> = (args) => (
|
||||
<IntlProvider locale='en'>
|
||||
<Toast {...args} />
|
||||
</IntlProvider>
|
||||
);
|
||||
|
||||
export const Success = Template.bind({});
|
||||
Success.args = {
|
||||
type: 'success',
|
||||
};
|
||||
|
||||
export const Error = Template.bind({});
|
||||
Error.args = {
|
||||
type: 'error',
|
||||
};
|
||||
|
||||
export const Info = Template.bind({});
|
||||
Info.args = {
|
||||
type: 'info',
|
||||
};
|
Ładowanie…
Reference in New Issue