index.stories.tsx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. import type { Meta, StoryObj } from '@storybook/react'
  2. import { fn } from '@storybook/test'
  3. import { RocketLaunchIcon } from '@heroicons/react/20/solid'
  4. import { Button } from '.'
  5. const meta = {
  6. title: 'Base/Button',
  7. component: Button,
  8. parameters: {
  9. layout: 'centered',
  10. },
  11. tags: ['autodocs'],
  12. argTypes: {
  13. loading: { control: 'boolean' },
  14. variant: {
  15. control: 'select',
  16. options: ['primary', 'warning', 'secondary', 'secondary-accent', 'ghost', 'ghost-accent', 'tertiary'],
  17. },
  18. },
  19. args: {
  20. variant: 'ghost',
  21. onClick: fn(),
  22. children: 'adsf',
  23. },
  24. } satisfies Meta<typeof Button>
  25. export default meta
  26. type Story = StoryObj<typeof meta>
  27. export const Default: Story = {
  28. args: {
  29. variant: 'primary',
  30. loading: false,
  31. children: 'Primary Button',
  32. },
  33. }
  34. export const Secondary: Story = {
  35. args: {
  36. variant: 'secondary',
  37. children: 'Secondary Button',
  38. },
  39. }
  40. export const SecondaryAccent: Story = {
  41. args: {
  42. variant: 'secondary-accent',
  43. children: 'Secondary Accent Button',
  44. },
  45. }
  46. export const Ghost: Story = {
  47. args: {
  48. variant: 'ghost',
  49. children: 'Ghost Button',
  50. },
  51. }
  52. export const GhostAccent: Story = {
  53. args: {
  54. variant: 'ghost-accent',
  55. children: 'Ghost Accent Button',
  56. },
  57. }
  58. export const Tertiary: Story = {
  59. args: {
  60. variant: 'tertiary',
  61. children: 'Tertiary Button',
  62. },
  63. }
  64. export const Warning: Story = {
  65. args: {
  66. variant: 'warning',
  67. children: 'Warning Button',
  68. },
  69. }
  70. export const Disabled: Story = {
  71. args: {
  72. variant: 'primary',
  73. disabled: true,
  74. children: 'Disabled Button',
  75. },
  76. }
  77. export const Loading: Story = {
  78. args: {
  79. variant: 'primary',
  80. loading: true,
  81. children: 'Loading Button',
  82. },
  83. }
  84. export const WithIcon: Story = {
  85. args: {
  86. variant: 'primary',
  87. children: (
  88. <>
  89. <RocketLaunchIcon className="h-4 w-4 mr-1.5 stroke-[1.8px]" />
  90. Launch
  91. </>
  92. ),
  93. },
  94. }