import type { Meta, StoryObj } from '@storybook/nextjs-vite'; import { ScrollShadow } from '../components/ui/scroll-fade'; const meta = { title: 'UI/ScrollShadow', component: ScrollShadow, argTypes: { axis: { control: 'select', options: ['vertical', 'horizontal', 'both'], }, color: { control: 'text' }, }, parameters: { docs: { description: { component: 'Wrapper that makes its child scrollable and fades the edges where more content exists. ' + 'The fade color defaults to the page background token and is theme-aware; pass a card/light ' + 'surface color when the scrollable sits on another surface.', }, }, }, } satisfies Meta; export default meta; type Story = StoryObj; const COLUMNS = ['HOSTNAME', 'PID', 'NAME', 'PATH', 'STATE', 'UID', 'RESIDENT', 'THREADS', 'START TIME']; const WideTable = () => (
{COLUMNS.map(col => (
{col}
))}
{[1, 2, 3].map(row => (
{COLUMNS.map(col => (
{col.toLowerCase()}-{row}
))}
))}
); /** Wide table: right fade on load, left fade appears once scrolled. */ export const HorizontalTable: Story = { args: { axis: 'horizontal', children: , }, render: args => (
), }; const LongList = () => (
{Array.from({ length: 20 }).map((_, i) => (
Message {i + 1}
))}
); /** Long list: bottom fade on load, top fade appears once scrolled down. */ export const VerticalList: Story = { args: { axis: 'vertical', children: , scrollClassName: 'h-[320px]', }, render: args => (
), }; /** * Light-surface usage (e.g. ChatMessageList themes): pass the surface color * the content sits on — with theme-aware tokens the same prop value works in * both themes; a literal color is shown here to make the story self-contained. */ export const LightSurface: Story = { args: { axis: 'vertical', color: '#ffffff', children: (
{Array.from({ length: 20 }).map((_, i) => (
Light message {i + 1}
))}
), scrollClassName: 'h-[320px]', }, render: args => (
), }; /** Both axes at once. */ export const BothAxes: Story = { args: { axis: 'both', children: , scrollClassName: 'h-[200px]', }, render: args => (
), };