Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
109 changes: 109 additions & 0 deletions src/components/file-picker/file-picker.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import FilePicker from './file-picker';

Comment thread
jaieds marked this conversation as resolved.
// FilePicker component story configuration
const meta: Meta = {
title: 'Atoms/FilePicker',
component: FilePicker,
Comment thread
jaieds marked this conversation as resolved.
parameters: {
layout: 'centered',
},
tags: [ 'autodocs' ],
argTypes: {
size: {
control: 'select',
options: [ 'sm', 'md', 'lg' ],
},
},
decorators: [
( Story ) => (
<div style={ { width: '320px' } }>
<Story />
</div>
),
],
} satisfies Meta<typeof FilePicker>;

export default meta;

type Story = StoryObj<typeof FilePicker>;

export const Default: Story = {
args: {
size: 'md',
label: 'Upload document',
disabled: false,
error: false,
clearable: false,
},
};

export const PrefilledValue: Story = {
args: {
...Default.args,
value: 'annual-report-2025.pdf',
},
};

export const ControlledFile: Story = {
args: {
...Default.args,
value: new File( [ 'force-ui' ], 'design-tokens.json', {
type: 'application/json',
} ),
},
};

export const Multiple: Story = {
args: {
...Default.args,
multiple: true,
value: [
new File( [ 'a' ], 'logo-light.svg', { type: 'image/svg+xml' } ),
new File( [ 'b' ], 'logo-dark.svg', { type: 'image/svg+xml' } ),
],
Comment thread
jaieds marked this conversation as resolved.
},
};

export const Clearable: Story = {
args: {
...Default.args,
clearable: true,
value: 'brand-guidelines.pdf',
},
};

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

export const Error: Story = {
args: {
...Default.args,
error: true,
},
};

export const SizeSm: Story = {
args: {
...Default.args,
size: 'sm',
},
};

export const SizeMd: Story = {
args: {
...Default.args,
size: 'md',
},
};

export const SizeLg: Story = {
args: {
...Default.args,
size: 'lg',
},
};
Loading
Loading