import { useState } from "react"; import { ViewCartButton } from "./index"; import { DocsPage } from "@shared/stories/DocsTemplate"; import type { Meta, StoryObj } from "@storybook/react"; const meta: Meta = { title: "Components/ViewCartButton", component: ViewCartButton, tags: ["autodocs"], parameters: { layout: "centered", docs: { page: DocsPage, description: { component: "A button component for viewing cart contents with total price display and open/closed states.", }, }, }, argTypes: { cartTotalText: { control: { type: "text" }, description: "Text displaying the cart total", }, isOpen: { control: { type: "boolean" }, description: "Whether the cart is open", }, onClick: { action: "clicked", description: "Callback function when button is clicked", }, }, args: { cartTotalText: "$99.99", isOpen: false, onClick: () => {}, }, }; export default meta; type Story = StoryObj; // Default button export const Default: Story = { args: {}, }; // With cart total export const WithCartTotal: Story = { args: { cartTotalText: "$149.99", }, }; // Open state export const Open: Story = { args: { cartTotalText: "$99.99", isOpen: true, }, }; // Closed state export const Closed: Story = { args: { cartTotalText: "$99.99", isOpen: false, }, }; // Interactive state export const Interactive: Story = { render: () => { const [isOpen, setIsOpen] = useState(false); return (
setIsOpen(!isOpen)} /> {isOpen && (

Cart is open

)}
); }, parameters: { docs: { description: { story: "Interactive ViewCartButton that toggles open/closed state on click.", }, }, }, }; // Different totals export const DifferentTotals: Story = { render: () => (
{}} /> {}} /> {}} /> {}} />
), parameters: { docs: { description: { story: "ViewCartButton with different cart total values.", }, }, }, }; // Responsive behavior export const Responsive: Story = { render: () => (

Mobile View (btn-small)

{}} />

Desktop View (btn-medium)

{}} />
), parameters: { docs: { description: { story: "ViewCartButton adapts its size responsively - smaller on mobile, larger on desktop.", }, }, }, }; // Open and closed states export const OpenAndClosed: Story = { render: () => (

Closed State

{}} />

Open State

{}} />
), parameters: { docs: { description: { story: "ViewCartButton in both open and closed states.", }, }, }, }; // All variants showcase export const AllVariants: Story = { render: () => (

States

{}} /> {}} />

Different Totals

{}} /> {}} /> {}} />
), parameters: { docs: { description: { story: "Showcase of all ViewCartButton variants and states.", }, }, }, };