import type { Meta, StoryObj } from "@storybook/react-vite"; import React from "react"; import { userEvent, within } from "storybook/test"; import { Button } from "../../components"; import { ModalService } from "../../contexts"; import { useAlert } from "./usealert"; import { useConfirm } from "./useconfirm"; import { usePrompt } from "./useprompt"; const meta: Meta = { argTypes: { onConfirm: { action: "onConfirm" }, onCancel: { action: "onCancel" }, }, title: "Hooks/Dialog", decorators: [ (Story) => ( ), ], play: async ({ canvasElement }) => { const canvas = within(canvasElement); const button = canvas.getByRole("button"); await userEvent.click(button, { delay: 10 }); }, }; export default meta; type Story = StoryObj; export const Alert: Story = { name: "useAlert", render: (args) => { const alert = useAlert(); return ( ); }, }; export const Confirm: Story = { name: "useConfirm", render: (args) => { const confirm = useConfirm(); return ( ); }, }; export const Prompt: Story = { name: "usePrompt", render: (args) => { const prompt = usePrompt(); return ( ); }, };