-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
packages/go-ui-storybook/src/stories/RawFileInput.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |