All files / react-base/src/components/ui badge.stories.tsx

0% Statements 0/101
100% Branches 1/1
100% Functions 1/1
0% Lines 0/101

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119                                                                                                                                                                                                                                             
import type { Meta, StoryObj } from "@storybook/react";
import { Badge } from "./badge";
 
const meta = {
  title: "Design System/Badge",
  component: Badge,
  tags: ["autodocs"],
  parameters: {
    docs: {
      description: {
        component: "Compact label for status, counts, and metadata.",
      },
    },
  },
  argTypes: {
    variant: {
      control: "select",
      options: ["default", "brand", "secondary", "destructive", "outline"],
    },
  },
} satisfies Meta<typeof Badge>;
 
export default meta;
type Story = StoryObj<typeof meta>;
 
export const Default: Story = {
  args: {
    children: "Default",
  },
  parameters: {
    docs: {
      source: {
        code: `<Badge>Default</Badge>`,
      },
    },
  },
};
 
export const Brand: Story = {
  args: {
    children: "Brand",
    variant: "brand",
  },
  parameters: {
    docs: {
      source: {
        code: `<Badge variant="brand">Brand</Badge>`,
      },
    },
  },
};
 
export const Secondary: Story = {
  args: {
    children: "Secondary",
    variant: "secondary",
  },
  parameters: {
    docs: {
      source: {
        code: `<Badge variant="secondary">Secondary</Badge>`,
      },
    },
  },
};
 
export const Destructive: Story = {
  args: {
    children: "Destructive",
    variant: "destructive",
  },
  parameters: {
    docs: {
      source: {
        code: `<Badge variant="destructive">Destructive</Badge>`,
      },
    },
  },
};
 
export const Outline: Story = {
  args: {
    children: "Outline",
    variant: "outline",
  },
  parameters: {
    docs: {
      source: {
        code: `<Badge variant="outline">Outline</Badge>`,
      },
    },
  },
};
 
export const AllVariants: Story = {
  parameters: {
    docs: {
      source: {
        code: `<div className="flex flex-wrap items-center gap-2">
  <Badge>Default</Badge>
  <Badge variant="brand">Brand</Badge>
  <Badge variant="secondary">Secondary</Badge>
  <Badge variant="destructive">Destructive</Badge>
  <Badge variant="outline">Outline</Badge>
</div>`,
      },
    },
  },
  render: () => (
    <div className="flex flex-wrap items-center gap-2">
      <Badge>Default</Badge>
      <Badge variant="brand">Brand</Badge>
      <Badge variant="secondary">Secondary</Badge>
      <Badge variant="destructive">Destructive</Badge>
      <Badge variant="outline">Outline</Badge>
    </div>
  ),
};