Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@ const meta = {
},
tags: ['autodocs'],
argTypes: {
length: { control: { type: 'number', min: 4, max: 8 } },
disabled: { control: 'boolean' },
error: { control: 'boolean' },
autoFocus: { control: 'boolean' },
},
args: {
length: 6,
disabled: false,
error: false,
autoFocus: false,
},
} satisfies Meta<typeof CodeInput>
Expand All @@ -28,27 +24,17 @@ type Story = StoryObj<typeof meta>

export const Default: Story = {}

export const WithError: Story = {
args: {
error: true,
},
}

export const Disabled: Story = {
args: {
disabled: true,
},
}

export const FourDigits: Story = {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we removing the length prop?

Copy link
Copy Markdown
Member Author

@OmarBasem OmarBasem Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

(I was thinking devs would be using our ZD backend which is using 6 digit code, but yeah keeping it dynamic makes sense anyways 👍 )

args: {
length: 4,
},
}

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}`)
},
},
Expand All @@ -61,18 +47,10 @@ export const AllStates: Story = {
<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-red-500 font-medium">Error</span>
<CodeInput error />
</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 className="flex flex-col gap-2 items-center">
<span className="text-sm text-gray-500 font-medium">4-digit</span>
<CodeInput length={4} />
</div>
</div>
),
}
Loading
Loading