mirror of
https://github.com/ershisan99/flashcards-example-project.git
synced 2025-12-16 20:59:27 +00:00
35 lines
682 B
TypeScript
35 lines
682 B
TypeScript
import { useState } from 'react'
|
|
|
|
import { Checkbox } from './checkbox'
|
|
import { Meta, StoryObj } from '@storybook/react'
|
|
const meta = {
|
|
component: Checkbox,
|
|
tags: ['autodocs'],
|
|
title: 'Components/Checkbox',
|
|
} satisfies Meta<typeof Checkbox>
|
|
|
|
export default meta
|
|
|
|
type Story = StoryObj<typeof meta>
|
|
export const Uncontrolled: Story = {
|
|
args: {
|
|
disabled: false,
|
|
label: 'Click here',
|
|
},
|
|
}
|
|
|
|
export const Controlled: Story = {
|
|
render: args => {
|
|
const [checked, setChecked] = useState(false)
|
|
|
|
return (
|
|
<Checkbox
|
|
{...args}
|
|
checked={checked}
|
|
label={'Click here'}
|
|
onChange={() => setChecked(!checked)}
|
|
/>
|
|
)
|
|
},
|
|
}
|