import type { Meta, StoryObj } from '@storybook/react-vite' import { Card } from './Card' import { ScrollArea } from './ScrollArea' /** A region that scrolls without taking width for its scrollbar. */ const meta = { title: 'Layout/ScrollArea', component: ScrollArea, parameters: { controls: { disable: true } }, args: { children: null }, } satisfies Meta export default meta type Story = StoryObj const rows = Array.from({ length: 40 }, (_, i) => `Row ${i + 1}`) /** A list taller than its box. The bar shows at rest, because there is more to scroll to. */ export const Default: Story = { render: () => (
    {rows.map((row) => (
  • {row}
  • ))}
), } /** Rows that stick to the top as the list moves under them. The bar stays above them. */ export const StickyHeadings: Story = { render: () => ( {['Group one', 'Group two'].map((group) => (

{group}

{rows.slice(0, 8).map((row) => (

{row}

))}
))}
), } /** Nothing to scroll: the region draws exactly as a plain box would, and no bar. */ export const Fits: Story = { render: () => (
    {rows.slice(0, 4).map((row) => (
  • {row}
  • ))}
), } /** A row wider than its box — a table, a board. */ export const Horizontal: Story = { render: () => (
{rows.slice(0, 12).map((row) => (
{row}
))}
), } /** Both ways, with the corner where the two bars would meet. */ export const Both: Story = { render: () => (
{rows.map((row) => (
{row} — a line long enough to run past the box
))}
), } /** A sideways region inside a scrolling page — a table in a content column. A wheel down over it moves the page; a swipe sideways moves the region. */ export const SidewaysInsideAPage: Story = { render: () => (
{rows.slice(0, 3).map((row) => (

{row}

))}
{rows.slice(0, 12).map((row) => (
{row}
))}
{rows.slice(3).map((row) => (

{row}

))}
), }