Add Toast story

toast-story
Alex Gleason 2023-02-03 16:05:48 -06:00
rodzic 8bd175e0e4
commit a893cb72d5
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
2 zmienionych plików z 41 dodań i 1 usunięć

Wyświetl plik

@ -142,4 +142,7 @@ const Toast = (props: IToast) => {
);
};
export default Toast;
export {
Toast as default,
Toast,
};

Wyświetl plik

@ -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',
};