import React, { useEffect, useId } from 'react'
import { type Meta, type StoryObj } from '@storybook/react'
import { expect, within } from '@storybook/test'
import { Button } from '~components/ButtonV1'
import { ToastNotification, useToastNotification } from '../index'
const meta = {
title: 'Components/Notifications/ToastNotification',
component: ToastNotification,
args: {
id: 'abc-123',
variant: 'success',
title: 'Success',
children: (
),
},
} satisfies Meta
export default meta
type Story = StoryObj
const ToastNotificationTemplate: Story = {
render: (args) => {
const reactId = useId()
const { updateToastNotification } = useToastNotification()
useEffect(() => {
updateToastNotification({
...args,
id: args.id ?? reactId,
message: args.children,
persistent: args.hideCloseIcon,
})
}, [args])
return
},
}
export const Playground: Story = {
...ToastNotificationTemplate,
parameters: {
docs: {
canvas: {
sourceState: 'shown',
},
},
},
}
export const CreateNotification: Story = {
render: () => {
const { addToastNotification } = useToastNotification()
return (