import type { Meta, StoryObj } from "@storybook/react-vite";
import type { ReactNode } from "react";
import { Box } from "../containers/Box";
import { Story } from "../story-components/Story";
import { ScrollView } from "./ScrollView";
import { Text } from "./Text";
import { View } from "./View";
export default {
title: "alouette/Primitives/ScrollView",
component: ScrollView,
parameters: {
componentSubtitle:
"A scrollable container (RN ScrollView) with className support for the scroll view and its content container",
docs: {
description: {
component: `### Features
- Vertical (default) or horizontal scrolling via \`horizontal\`
- NativeWind \`className\` maps to \`style\` (the scroll view frame: size, border, background)
- NativeWind \`contentContainerClassName\` maps to \`contentContainerStyle\` (the scrolled content: padding, gap, alignment)
### Usage
~~~tsx
Content
~~~`,
},
},
},
} satisfies Meta;
interface RowProps {
label: string;
}
function Row({ label }: RowProps): ReactNode {
return (
{label}
);
}
interface RowsProps {
count: number;
}
function Rows({ count }: RowsProps): ReactNode {
return (
<>
{Array.from({ length: count }, (_, index) => (
))}
>
);
}
export const PreviewStory: StoryObj = {
name: "ScrollView Preview",
parameters: {
layout: "padded",
chromatic: { disableSnapshot: true },
},
render: () => (
),
};
export const VariantsStory: StoryObj = {
name: "ScrollView",
render: () => (
{Array.from({ length: 12 }, (_, index) => (
))}
),
};