Skip to content

Commit

Permalink
feat(shared/ui/cuhacking/components): create button stories
Browse files Browse the repository at this point in the history
  • Loading branch information
HasithDeAlwis authored and MFarabi619 committed Nov 21, 2024
1 parent 560758c commit 17d5ea1
Showing 1 changed file with 98 additions and 0 deletions.
98 changes: 98 additions & 0 deletions libs/shared/ui/src/cuHacking/components/button/button.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import type { Meta, StoryObj } from '@storybook/react'
import {
ChevronRightIcon,
EnvelopeOpenIcon,
ReloadIcon,
} from '@radix-ui/react-icons'
import { fn } from '@storybook/test'
import React from 'react'
import { Button } from './button'

const meta = {
title: 'cuHacking Design System/Button',
component: Button,
tags: ['autodocs'],
parameters: {
layout: 'centered',
},
args: {
children: 'Button',
variant: 'default',
onClick: fn(),
},
argTypes: {
variant: {
options: [
'default',
'secondary',
'destructive',
'outline',
'ghost',
'link',
],
control: { type: 'select' },
},
asChild: {
control: {
disable: true,
},
},
size: {
options: ['default', 'sm', 'lg', 'icon'],
control: { type: 'select' },
},
},
} satisfies Meta<typeof Button>

export default meta
type Story = StoryObj<typeof meta>

export const Primary: Story = {}
export const Secondary: Story = { args: { variant: 'secondary' } }
export const Destructive: Story = { args: { variant: 'destructive' } }
export const Outline: Story = { args: { variant: 'outline' } }
export const Ghost: Story = { args: { variant: 'ghost' } }
export const Link: Story = { args: { variant: 'link' } }

export const Icon: Story = {
args: {
variant: 'outline',
size: 'icon',
children: (
<ChevronRightIcon className="size-4" />
),
},
argTypes: {
children: { control: { disable: true } },
},
}

export const WithIcon: Story = {
args: {
children: (
<>
<EnvelopeOpenIcon className="mr-2 size-4" />
Login with Email
</>
),
},
argTypes: {
children: { control: { disable: true } },
},
}

export const Loading: Story = {
args: {
variant: 'secondary',
disabled: true,
children: (
<>
<ReloadIcon className="mr-2 size-4 animate-spin" />
Please wait
</>
),
},
argTypes: {
children: { control: { disable: true } },
},
}

0 comments on commit 17d5ea1

Please sign in to comment.