Skip to content

Commit

Permalink
feat(Popup)!: fix FilePreview local storybook for test
Browse files Browse the repository at this point in the history
  • Loading branch information
oynikishin committed Nov 26, 2024
1 parent c8ff66a commit 2a980d7
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions src/components/FilePreview/__stories__/FilePreview.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,56 +102,54 @@ const CollageTemplate: StoryFn<FilePreviewProps> = () => {

export const Collage = CollageTemplate.bind({});

const noClickableTemplateActions = [
{
icon: <Xmark width={14} height={14} />,
onClick: () => action('Are you sure you want to delete the file?'),
title: 'Close',
},
];

const NoClickableTemplate: StoryFn<Omit<FilePreviewProps, 'actions'>> = (args) => {
return (
<Flex gap={4}>
<FilePreview {...args} file={{name: 'No clickable', type: 'text/docs'} as File} />
<FilePreview
{...args}
file={{name: 'No clickable with actions', type: 'text/docs'} as File}
actions={[
{
icon: <Xmark width={14} height={14} />,
onClick: () => action('Are you sure you want to delete the file?'),
title: 'Close',
},
]}
actions={noClickableTemplateActions}
/>
<FilePreview
{...args}
file={{name: 'Clickable with actions', type: 'text/docs'} as File}
onClick={() => action('onClick')}
actions={[
{
icon: <Xmark width={14} height={14} />,
onClick: () => action('Are you sure you want to delete the file?'),
title: 'Close',
},
]}
actions={noClickableTemplateActions}
/>
</Flex>
);
};

export const NoClickable = NoClickableTemplate.bind({});

const withoutActionTooltipTemplateActions = [
{
icon: <Xmark width={14} height={14} />,
onClick: () => action('onClose'),
title: 'Close',
tooltipExtraProps: {
disabled: true,
},
},
];

const WithoutActionTooltipTemplate: StoryFn<Omit<FilePreviewProps, 'actions'>> = (args) => {
return (
<Flex gap={4}>
<FilePreview
{...args}
file={{name: 'Clicable without tooltip', type: 'text/docs'} as File}
onClick={() => action('onClick')}
actions={[
{
icon: <Xmark width={14} height={14} />,
onClick: () => action('onClose'),
title: 'Close',
tooltipExtraProps: {
disabled: true,
},
},
]}
actions={withoutActionTooltipTemplateActions}
/>
</Flex>
);
Expand Down

0 comments on commit 2a980d7

Please sign in to comment.