import { useState } from "react"; import type { Meta, StoryObj } from "@storybook/react"; import { leftArrow, menu } from "@simplybusiness/icons"; import type { ButtonProps } from "./Button"; import { Button } from "./Button"; import { Icon } from "../Icon"; import { excludeControls } from "../../utils"; import "./Button.story.styles.css"; type StoryType = StoryObj; const meta: Meta = { title: "Components/Button", component: Button, excludeStories: ["Counter", "PressButton"], argTypes: { isLoading: { if: { arg: "isSuccess", truthy: false, }, }, isSuccess: { if: { arg: "isLoading", truthy: false, }, }, href: { if: { arg: "elementType", eq: "a", }, }, rel: { if: { arg: "elementType", eq: "a", }, }, target: { if: { arg: "elementType", eq: "a", }, }, type: { if: { arg: "elementType", neq: "a", }, }, ...excludeControls("role", "children"), }, }; export const Default: StoryType = { render: (args: ButtonProps) => ); }; export const PressButton = () => { const [pressLogs, setPressLogs] = useState<[] | string[]>([]); const log = (e: string) => { setPressLogs(logs => [...logs.slice(-5), e]); }; return (
    {pressLogs.map((pressLog, i) => (
  • {pressLog}
  • ))}
); }; export default meta;