import type { Meta, StoryFn } from '@storybook/react'; import { useCallback, useState } from 'react'; import { Button } from '../button'; import type { InputProps } from '../input'; import { Input } from '../input'; import type { ConfirmModalProps } from './confirm-modal'; import { ConfirmModal } from './confirm-modal'; import type { ModalProps } from './modal'; import { Modal } from './modal'; import type { OverlayModalProps } from './overlay-modal'; import { OverlayModal } from './overlay-modal'; export default { title: 'UI/Modal', component: Modal, argTypes: {}, } satisfies Meta; const Template: StoryFn = args => { const [open, setOpen] = useState(false); return ( <> ); }; export const Default: StoryFn = Template.bind(undefined); Default.args = { title: 'Modal Title', description: 'If the day is done, if birds sing no more, if the wind has flagged tired, then draw the veil of darkness thick upon me, even as thou hast wrapt the earth with the coverlet of sleep and tenderly closed the petals of the drooping lotus at dusk.', }; const wait = () => new Promise(resolve => setTimeout(resolve, 1000)); const ConfirmModalTemplate: StoryFn = () => { const [open, setOpen] = useState(false); const [loading, setLoading] = useState(false); const [inputStatus, setInputStatus] = useState('default'); const handleConfirm = useCallback(async () => { setLoading(true); await wait(); setInputStatus(inputStatus !== 'error' ? 'error' : 'success'); setLoading(false); }, [inputStatus]); return ( <> ); }; const OverlayModalTemplate: StoryFn = () => { const [open, setOpen] = useState(false); return ( <> } /> ); }; export const Confirm: StoryFn = ConfirmModalTemplate.bind(undefined); export const Overlay: StoryFn = OverlayModalTemplate.bind(undefined);