import { Modal } from "./index"; import { DocsPage } from "@shared/stories/DocsTemplate"; import type { Meta, StoryObj } from "@storybook/react"; const meta: Meta = { title: "Components/Modal", component: Modal, tags: ["autodocs"], parameters: { layout: "centered", docs: { page: DocsPage, description: { component: "A flexible modal component with customizable sizing, animations, and behavior options. Supports portal rendering, escape key handling, and overlay click dismissal.", }, }, }, argTypes: { isOpen: { control: { type: "boolean" }, description: "Whether the modal is open", }, title: { control: { type: "text" }, description: "Optional title for the modal header", }, size: { control: { type: "select" }, options: ["xs", "sm", "md", "lg", "xl"], description: "Modal size variant", }, animation: { control: { type: "select" }, options: ["popper", "bottomSheet"], description: "Animation variant", }, shape: { control: { type: "select" }, options: ["rounded", "square"], description: "Shape variant", }, shouldCloseOnEsc: { control: { type: "boolean" }, description: "Whether to close on escape key", }, shouldCloseOnOverlayClick: { control: { type: "boolean" }, description: "Whether to close on overlay click", }, }, args: { isOpen: true, title: "Modal Title", size: "md", animation: "popper", shape: "rounded", shouldCloseOnEsc: true, shouldCloseOnOverlayClick: true, }, }; export default meta; type Story = StoryObj; export const Default: Story = { args: { children: (

This is a default modal with some content. You can close it by clicking the X button, pressing Escape, or clicking outside the modal.

), }, }; export const Small: Story = { args: { size: "xs", children: (

Small modal content

), }, }; export const Large: Story = { args: { size: "xl", children: (

Large Modal

This is a large modal that can accommodate more content. It's useful for forms, detailed information, or complex layouts.

Content 1
Content 2
), }, }; export const BottomSheet: Story = { args: { animation: "bottomSheet", size: "sm", className: "top-auto bottom-0 max-w-none rounded-t-lg", children: (

Bottom Sheet

This modal slides up from the bottom, perfect for mobile interfaces.

), }, }; export const WithoutTitle: Story = { args: { title: undefined, children: (

This modal doesn't have a title in the header, but still has a close button.

), }, }; export const NoCloseButton: Story = { args: { closeButtonClassName: "hidden", children: (

This modal doesn't have a close button. You can only close it by pressing Escape or clicking outside.

), }, };