import type { Meta, StoryObj } from '@storybook/nextjs'
import { useCallback } from 'react'
import Toast, { ToastProvider, useToastContext } from '.'
const ToastControls = () => {
const { notify } = useToastContext()
const trigger = useCallback((type: 'success' | 'error' | 'warning' | 'info') => {
notify({
type,
message: `This is a ${type} toast`,
children: type === 'info' ? 'Additional details can live here.' : undefined,
})
}, [notify])
return (
)
}
const ToastProviderDemo = () => {
return (
)
}
const StaticToastDemo = () => {
return (
Static API
)
}
const meta = {
title: 'Base/Feedback/Toast',
component: ToastProviderDemo,
parameters: {
layout: 'centered',
docs: {
description: {
component: 'ToastProvider based notifications and the static Toast.notify helper. Buttons showcase each toast variant.',
},
},
},
tags: ['autodocs'],
} satisfies Meta
export default meta
type Story = StoryObj
export const Provider: Story = {}
export const StaticApi: Story = {
render: () => ,
}