import type { Meta, StoryObj } from "@storybook/react" import { useState } from "react" import { Button } from "../../action/button/Button" import { SvgUse } from "../../shared/SvgUse" import { Collapsible, CollapsibleContent, CollapsibleTrigger, CollapsibleWithChevron, } from "./Collapsible" /** * A component that allows users to toggle the visibility of content with smooth animations. * Use CollapsibleWithChevron for automatic state management and chevron behavior. */ const meta = { title: "base/action/Collapsible", component: Collapsible, tags: ["autodocs"], parameters: { layout: "centered", }, } satisfies Meta export default meta type Story = StoryObj /** * Automatic collapsible with built-in state and chevron - no useState needed! * Features smooth height animation. */ export const Automatic: Story = { render: () => ( Click to toggle } className="w-[350px]" >

No useState needed! The chevron appears automatically.

Notice the smooth height animation when toggling.

), } /** * FAQ style with custom chevron styling and animation. */ export const FAQ: Story = { render: () => ( What is this? } chevronClassName="size-4 text-blue-600" className="w-[350px]" >

This is the answer to your question.

The content smoothly animates in and out.

), } /** * Multiple automatic collapsibles with animations. */ export const Multiple: Story = { render: () => (
Section 1 } >

Content 1

Each section animates independently.

Section 2 } >

Content 2

Try opening multiple sections to see the smooth animations.

), } /** * Manual usage with useState (for comparison) - also animated. */ export const Manual: Story = { render: () => { const [open, setOpen] = useState(false) return (

This requires useState boilerplate.

But still has the same smooth animation!

) }, } /** * Without chevron but with animation. */ export const WithoutChevron: Story = { render: () => (

Simple collapsible without chevron.

Still has smooth height animation.

), } /** * Long content to demonstrate smooth scrolling animation. */ export const LongContent: Story = { render: () => ( Long content example } className="w-[350px]" >

This is a longer content example to show how the animation handles different content heights.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

The animation smoothly adjusts to the content height.

), }