mirror of
https://github.com/ershisan99/flashcards-example-project.git
synced 2025-12-24 05:09:29 +00:00
add modals
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import { useState } from 'react'
|
||||
|
||||
import { Meta, StoryObj } from '@storybook/react'
|
||||
|
||||
import { DeleteDeckDialog } from './'
|
||||
|
||||
import { Button } from '@/components'
|
||||
|
||||
const meta = {
|
||||
title: 'Decks/Delete Deck Dialog',
|
||||
component: DeleteDeckDialog,
|
||||
tags: ['autodocs'],
|
||||
} satisfies Meta<typeof DeleteDeckDialog>
|
||||
|
||||
export default meta
|
||||
type Story = StoryObj<typeof meta>
|
||||
|
||||
export const Default: Story = {
|
||||
args: {
|
||||
deckName: 'Deck Name',
|
||||
open: true,
|
||||
onOpenChange: () => {},
|
||||
},
|
||||
render: args => {
|
||||
const [open, setOpen] = useState(false)
|
||||
const closeModal = () => setOpen(false)
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button onClick={() => setOpen(true)}>Open Modal</Button>
|
||||
<DeleteDeckDialog
|
||||
{...args}
|
||||
onOpenChange={setOpen}
|
||||
open={open}
|
||||
onCancel={closeModal}
|
||||
onConfirm={closeModal}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user