import type { Meta, StoryObj } from '@storybook/nextjs-vite'; import { useState } from 'react'; import { Button } from '../components/ui/button'; import { Drawer, DrawerBody, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, type DrawerSide, } from '../components/ui/drawer'; const meta: Meta = { title: 'UI/Drawer', component: Drawer, parameters: { layout: 'centered', }, }; export default meta; type Story = StoryObj; export const Right: Story = { render: function Render() { const [open, setOpen] = useState(false); return ( Right Drawer This drawer slides in from the right.

Drawer content goes here.

); }, }; export const Left: Story = { render: function Render() { const [open, setOpen] = useState(false); return ( Left Drawer This drawer slides in from the left.

Drawer content goes here.

); }, }; export const Top: Story = { render: function Render() { const [open, setOpen] = useState(false); return ( Top Drawer This drawer slides in from the top.

Drawer content goes here.

); }, }; export const Bottom: Story = { render: function Render() { const [open, setOpen] = useState(false); return ( Bottom Drawer This drawer slides in from the bottom.

Drawer content goes here.

); }, }; export const AllSides: Story = { render: function Render() { const [openSide, setOpenSide] = useState(null); const sides: DrawerSide[] = ['right', 'left', 'top', 'bottom']; return (
{sides.map(side => ( setOpenSide(open ? side : null)}> {side.charAt(0).toUpperCase() + side.slice(1)} Drawer Slides in from the {side}.

Content for {side} drawer.

))}
); }, }; export const WithFooter: Story = { render: function Render() { const [open, setOpen] = useState(false); return ( Drawer with Footer This drawer includes a footer with actions.

Main content area.

); }, }; export const LongContent: Story = { render: function Render() { const [open, setOpen] = useState(false); return ( Scrollable Content This drawer has enough content to scroll. {Array.from({ length: 20 }, (_, i) => (

Item {i + 1}

Description for item {i + 1}

))}
); }, };