import {toast} from 'sonner'

import {Button} from '../components/atoms/button'
import {Toaster} from '../components/ui/sonner'

import type {Meta, StoryObj} from '@storybook/react-vite'

const meta = {
  title: 'Ui/Toaster',
  component: Toaster,
  decorators: [
    Story => (
      <>
        <Story />
        <Toaster />
      </>
    ),
  ],
  tags: ['autodocs'],
  parameters: {},
  args: {},
} satisfies Meta

export default meta
type Story = StoryObj<typeof meta>

export const SuccessToast: Story = {
  decorators: [
    () => (
      <Button onClick={() => toast.success('Success toast!')}>
        Show success Toast
      </Button>
    ),
  ],
  args: {},
}

export const ErrorToast: Story = {
  decorators: [
    () => (
      <Button onClick={() => toast.error('Error toast!')}>
        Show error Toast
      </Button>
    ),
  ],
}
