import type { Meta, StoryObj } from '@storybook/react' import { useState } from 'react' import type { Toast } from './toast' import { ToastContainer, ToastProvider, useToast } from './toast' const meta: Meta = { title: 'Primitives/Toast', parameters: { layout: 'centered', backgrounds: { default: 'dark' } }, } export default meta type Story = StoryObj // Static display of all variants side by side (no auto-dismiss) export const AllVariants: Story = { name: 'All Variants', render: () => { const [toasts, setToasts] = useState([ { id: '1', variant: 'success', title: 'Session started', description: 'sess_01j9x8k2m is running in us-east-1.', }, { id: '2', variant: 'error', title: 'Session failed to start', description: 'Container exited with code 1. Check image pull logs.', }, { id: '3', variant: 'warning', title: 'Session nearing timeout', description: 'sess_01j9x7r9 will auto-terminate in 5 minutes.', }, { id: '4', variant: 'info', title: 'Snapshot created', description: 'snap_01j9xa1b2 saved successfully.', }, { id: '5', variant: 'default', title: 'Copied to clipboard', }, ]) return (
setToasts((t) => t.filter((x) => x.id !== id))} /> {toasts.map((t) => ( // Render inline for story visibility (not fixed positioned)

{t.title}

{t.description && (

{t.description}

)}
))}
) }, } function ToastDemo() { const { success, error, warning, info, toast } = useToast() return (
) } export const Interactive: Story = { name: 'Interactive (with Provider)', render: () => ( ), }