import type { Meta, StoryObj } from "@storybook/react" import { SvgUse } from "../../shared/SvgUse" import { Button } from "./Button" /** * Displays a button or a component that looks like a button. * * ## Props * - `variant`: "classic" | "solid" | "soft" | "surface" | "outline" | "ghost" (default: "solid") * - `size`: "1" | "2" | "3" | "4" (default: "2") * - `color`: "gray" | "gold" | "bronze" | "brown" | "yellow" | "amber" | "orange" | "tomato" | "red" | "ruby" | "crimson" | "pink" | "plum" | "purple" | "violet" | "iris" | "indigo" | "blue" | "cyan" | "teal" | "jade" | "green" | "grass" | "lime" | "mint" | "sky" (default: "gray") * - `radius`: "none" | "small" | "medium" | "large" | "full" * - `highContrast`: boolean * - `loading`: boolean (default: false) * - `disabled`: boolean * - `asChild`: boolean */ const meta = { title: "base/action/Button", component: Button, tags: ["autodocs"], argTypes: { children: { control: "text", }, variant: { control: "select", options: ["classic", "solid", "soft", "surface", "outline", "ghost"], description: "The visual style of the button", }, size: { control: "select", options: ["1", "2", "3", "4"], description: "The size of the button", }, color: { control: "select", options: [ "gray", "gold", "bronze", "brown", "yellow", "amber", "orange", "tomato", "red", "ruby", "crimson", "pink", "plum", "purple", "violet", "iris", "indigo", "blue", "cyan", "teal", "jade", "green", "grass", "lime", "mint", "sky", ], description: "The color theme of the button", }, radius: { control: "select", options: ["none", "small", "medium", "large", "full"], description: "The border radius of the button", }, highContrast: { control: "boolean", description: "Whether to use high contrast colors", }, loading: { control: "boolean", description: "Whether the button is in a loading state", }, disabled: { control: "boolean", description: "Whether the button is disabled", }, }, parameters: { layout: "centered", }, args: { children: "Button", }, } satisfies Meta export default meta type Story = StoryObj /** * The default form of the button, used for primary actions and commands. */ export const Default: Story = {} /** * Use the `outline` button to reduce emphasis on secondary actions, such as * canceling or dismissing a dialog. */ export const Outline: Story = { args: { variant: "outline", }, } /** * Use the `ghost` button is minimalistic and subtle, for less intrusive * actions. */ export const Ghost: Story = { args: { variant: "ghost", }, } /** * Use the `soft` button to call for less emphasized actions, styled to * complement the primary button while being less conspicuous. */ export const Soft: Story = { args: { variant: "soft", }, } /** * Use the `surface` button for actions that should blend with the surface. */ export const Surface: Story = { args: { variant: "surface", }, } /** * Use the `classic` button for a traditional button appearance. */ export const Classic: Story = { args: { variant: "classic", }, } /** * Use the `destructive` button to indicate errors, alerts, or the need for * immediate attention. */ export const Destructive: Story = { args: { variant: "solid", color: "red", }, } /** * Use the `link` button to reduce emphasis on tertiary actions, such as * hyperlink or navigation, providing a text-only interactive element. */ export const Link: Story = { args: { variant: "ghost", color: "blue", }, } /** * Add the `disabled` prop to a button to prevent interactions and add a * loading indicator, such as a spinner, to signify an in-progress action. */ export const Loading: Story = { render: args => ( ), args: { ...Outline.args, disabled: true, }, } /** * Add an icon element to a button to enhance visual communication and * providing additional context for the action. */ export const WithIcon: Story = { render: args => ( ), args: { ...Soft.args, }, } /** * Use the `1` size for a smaller button, suitable for interfaces needing * compact elements without sacrificing usability. */ export const Small: Story = { args: { size: "1", }, } /** * Use the `3` size for a larger button, offering better visibility and * easier interaction for users. */ export const Large: Story = { args: { size: "3", }, } /** * Use the `4` size for the largest button. */ export const ExtraLarge: Story = { args: { size: "4", }, } /** * Add the `disabled` prop to prevent interactions with the button. */ export const Disabled: Story = { args: { disabled: true, }, } /** * Showcase different color variants of the button. */ export const Colors: Story = { render: () => (
), } /** * Showcase different radius options. */ export const Radius: Story = { render: () => (
), } /** * Showcase high contrast mode. */ export const HighContrast: Story = { render: () => (
), } /** * Showcase all variants in a grid layout. */ export const AllVariants: Story = { render: () => (
), } /** * Showcase all sizes in a vertical layout. */ export const AllSizes: Story = { render: () => (
), }