Skip to content

Commit

Permalink
Add RawFileInput Story
Browse files Browse the repository at this point in the history
  • Loading branch information
roshni73 committed May 16, 2024
1 parent f5d61eb commit 31cdbc1
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
74 changes: 74 additions & 0 deletions packages/go-ui-storybook/src/stories/RawFileInput.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { DownloadTwoLineIcon } from '@ifrc-go/icons';
import { RawFileInputProps } from '@ifrc-go/ui';
import type {
Meta,
StoryObj,
} from '@storybook/react';

import RawFileInput from './RawFileInput';

type RawFileInputSpecificProps = RawFileInputProps<string>;

type Story = StoryObj<RawFileInputSpecificProps>;

const meta: Meta<typeof RawFileInput > = {
title: 'Components/RawFileInput',
component: RawFileInput,
parameters: {
layout: 'centered',
design: {
type: 'figma',
url: 'https://www.figma.com/file/myeW85ibN5p2SlnXcEpxFD/IFRC-GO---UI-Current---1?type=design&node-id=0-4957&mode=design&t=KwxbuoUQxqcLyZbG-0',
},
},
tags: ['autodocs'],
decorators: [
function Component(_, ctx) {
const componentArgs = ctx.args as RawFileInputSpecificProps;
const onChange = () => {};

return (
<RawFileInput
// eslint-disable-next-line react/jsx-props-no-spreading
{...componentArgs}
onChange={onChange}
name="RawFileInput"

/>
);
},
],
};

export default meta;

export const Default: Story = {
args: {
name: 'RawFileInput',
children: <DownloadTwoLineIcon />,
},
};

export const Multiple: Story = {
args: {
name: 'RawFileInput',
children: 'Export',
multiple: true,
},
};

export const ReadOnly: Story = {
args: {
name: 'RawFileInput',
children: 'Export',
readOnly: true,
},
};

export const Disabled: Story = {
args: {
name: 'RawFileInput',
children: 'Export',
disabled: true,
},
};
17 changes: 17 additions & 0 deletions packages/go-ui-storybook/src/stories/RawFileInput.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {
RawFileInput as PureRawFileInput,
RawFileInputProps as PureRawFileInputProps,
} from '@ifrc-go/ui';

type RawFileInputProps<N> = PureRawFileInputProps<N>;

function WrappedRawFileInput< const N>(props: RawFileInputProps<N>) {
// eslint-disable-next-line react/jsx-props-no-spreading
return (
// eslint-disable-next-line react/jsx-props-no-spreading
<PureRawFileInput {...props} />

);
}

export default WrappedRawFileInput;

0 comments on commit 31cdbc1

Please sign in to comment.