From 2b13e153d6cfee1c6ae52fbea635d7debfa44daf Mon Sep 17 00:00:00 2001 From: Chris Parsons Date: Sun, 29 Mar 2026 22:09:45 -0700 Subject: [PATCH] Initial storybook components. --- .storybook/preview.ts | 1 + app/components/ui/button.stories.tsx | 107 +++++++++++++++++++++++++ app/components/ui/checkbox.stories.tsx | 57 +++++++++++++ 3 files changed, 165 insertions(+) create mode 100644 app/components/ui/button.stories.tsx create mode 100644 app/components/ui/checkbox.stories.tsx diff --git a/.storybook/preview.ts b/.storybook/preview.ts index f570f39..60a654d 100644 --- a/.storybook/preview.ts +++ b/.storybook/preview.ts @@ -1,5 +1,6 @@ import { withRouter } from 'storybook-addon-remix-react-router'; import type { Preview } from '@storybook/react-vite' +import '../app/app.css' const preview: Preview = { decorators: [withRouter], // This wraps all stories in a Router context diff --git a/app/components/ui/button.stories.tsx b/app/components/ui/button.stories.tsx new file mode 100644 index 0000000..2837377 --- /dev/null +++ b/app/components/ui/button.stories.tsx @@ -0,0 +1,107 @@ +import type { Meta, StoryObj } from "@storybook/react-vite"; +import { Button } from "./button"; + +const meta: Meta = { + title: "UI/Button", + component: Button, + tags: ["autodocs"], + argTypes: { + variant: { + control: "select", + options: ["default", "destructive", "outline", "secondary", "ghost", "link"], + }, + size: { + control: "select", + options: ["default", "sm", "lg", "icon", "icon-sm", "icon-lg"], + }, + disabled: { control: "boolean" }, + }, +}; + +export default meta; +type Story = StoryObj; + +export const Default: Story = { + args: { + children: "Button", + }, +}; + +export const Destructive: Story = { + args: { + variant: "destructive", + children: "Delete", + }, +}; + +export const Outline: Story = { + args: { + variant: "outline", + children: "Outline", + }, +}; + +export const Secondary: Story = { + args: { + variant: "secondary", + children: "Secondary", + }, +}; + +export const Ghost: Story = { + args: { + variant: "ghost", + children: "Ghost", + }, +}; + +export const Link: Story = { + args: { + variant: "link", + children: "Link", + }, +}; + +export const Small: Story = { + args: { + size: "sm", + children: "Small", + }, +}; + +export const Large: Story = { + args: { + size: "lg", + children: "Large", + }, +}; + +export const Disabled: Story = { + args: { + children: "Disabled", + disabled: true, + }, +}; + +export const AllVariants: Story = { + render: () => ( +
+ + + + + + +
+ ), +}; + +export const AllSizes: Story = { + render: () => ( +
+ + + +
+ ), +}; diff --git a/app/components/ui/checkbox.stories.tsx b/app/components/ui/checkbox.stories.tsx new file mode 100644 index 0000000..071121d --- /dev/null +++ b/app/components/ui/checkbox.stories.tsx @@ -0,0 +1,57 @@ +import type { Meta, StoryObj } from "@storybook/react-vite"; +import { Checkbox } from "./checkbox"; +import { Label } from "./label"; + +const meta: Meta = { + title: "UI/Checkbox", + component: Checkbox, + tags: ["autodocs"], + argTypes: { + checked: { control: "boolean" }, + disabled: { control: "boolean" }, + }, +}; + +export default meta; +type Story = StoryObj; + +export const Default: Story = {}; + +export const Checked: Story = { + args: { + defaultChecked: true, + }, +}; + +export const Disabled: Story = { + args: { + disabled: true, + }, +}; + +export const DisabledChecked: Story = { + args: { + disabled: true, + defaultChecked: true, + }, +}; + +export const WithLabel: Story = { + render: (args) => ( +
+ + +
+ ), +}; + +export const WithLabelDisabled: Story = { + render: () => ( +
+ + +
+ ), +};