import {MyToastRegion, queue} from '../src/Toast'; import {Button} from '../src/Button'; import type {Meta, StoryObj} from '@storybook/react'; interface ToastStoryArgs { title: string; description?: string; timeout?: number; buttonLabel: string; } const meta: Meta = { title: 'Toast', parameters: { layout: 'centered' }, tags: ['autodocs'], argTypes: { title: { control: 'text', description: 'The title of the toast.' }, description: { control: 'text', description: 'Optional description text.' }, timeout: { control: 'number', description: 'Auto-dismiss timeout in milliseconds.' }, buttonLabel: { control: 'text', description: 'Label for the trigger button.' } }, args: { title: 'Files uploaded', description: '3 files uploaded successfully.', buttonLabel: 'Show toast' } }; export default meta; type Story = StoryObj; export const Example: Story = { render: args => ( <> ), parameters: { docs: { source: { transform: () => { return ` const queue = new ToastQueue(); function MyToast(props: ToastProps) { return ; } function MyToastRegion() { return ( {({toast}) => ( {toast.content.title} {toast.content.description && ( {toast.content.description} )} )} ); } <> `; } } } } };