-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodeInput.stories.tsx
More file actions
56 lines (49 loc) · 1.26 KB
/
CodeInput.stories.tsx
File metadata and controls
56 lines (49 loc) · 1.26 KB
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
import type { Meta, StoryObj } from '@storybook/react-vite'
import { CodeInput } from '.'
const meta = {
title: 'Auth/CodeInput',
component: CodeInput,
parameters: {
layout: 'centered',
},
tags: ['autodocs'],
argTypes: {
disabled: { control: 'boolean' },
autoFocus: { control: 'boolean' },
},
args: {
disabled: false,
autoFocus: false,
},
} satisfies Meta<typeof CodeInput>
export default meta
type Story = StoryObj<typeof meta>
export const Default: Story = {}
export const Disabled: Story = {
args: {
disabled: true,
},
}
export const WithOnComplete: Story = {
args: {
onComplete: (code) => {
// biome-ignore lint/suspicious/noConsole: This is a demo/story
console.log(`Code complete: ${code}`)
alert(`Code complete: ${code}`)
},
},
}
export const AllStates: Story = {
render: () => (
<div className="flex flex-col gap-8 items-center">
<div className="flex flex-col gap-2 items-center">
<span className="text-sm text-gray-500 font-medium">Default</span>
<CodeInput />
</div>
<div className="flex flex-col gap-2 items-center">
<span className="text-sm text-gray-400 font-medium">Disabled</span>
<CodeInput disabled />
</div>
</div>
),
}