2022-11-09 22:57:21 +01:00
|
|
|
import React from 'react';
|
2023-07-13 22:22:40 +02:00
|
|
|
import { StoryFn, Meta } from '@storybook/react';
|
|
|
|
import { IconColor } from '../../../helpers/constants/design-system';
|
2023-04-05 18:11:10 +02:00
|
|
|
import { IconName } from '..';
|
2023-04-12 17:55:24 +02:00
|
|
|
import { ButtonIconSize } from './button-icon.types';
|
2022-11-09 22:57:21 +01:00
|
|
|
import { ButtonIcon } from './button-icon';
|
|
|
|
import README from './README.mdx';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
title: 'Components/ComponentLibrary/ButtonIcon',
|
|
|
|
component: ButtonIcon,
|
|
|
|
parameters: {
|
|
|
|
docs: {
|
|
|
|
page: README,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
argTypes: {
|
|
|
|
as: {
|
|
|
|
control: 'select',
|
|
|
|
options: ['button', 'a'],
|
|
|
|
},
|
|
|
|
},
|
2023-08-03 21:23:47 +02:00
|
|
|
args: {
|
|
|
|
iconName: IconName.Close,
|
|
|
|
ariaLabel: 'Close',
|
|
|
|
},
|
2023-07-13 22:22:40 +02:00
|
|
|
} as Meta<typeof ButtonIcon>;
|
2022-11-09 22:57:21 +01:00
|
|
|
|
2023-07-13 22:22:40 +02:00
|
|
|
const Template: StoryFn<typeof ButtonIcon> = (args) => <ButtonIcon {...args} />;
|
2023-04-12 17:55:24 +02:00
|
|
|
|
|
|
|
export const DefaultStory = Template.bind({});
|
2022-11-09 22:57:21 +01:00
|
|
|
|
|
|
|
DefaultStory.storyName = 'Default';
|
|
|
|
|
2023-07-13 22:22:40 +02:00
|
|
|
export const IconNameStory: StoryFn<typeof ButtonIcon> = (args) => (
|
2023-04-12 17:55:24 +02:00
|
|
|
<ButtonIcon {...args} />
|
|
|
|
);
|
2022-12-01 18:26:31 +01:00
|
|
|
|
2023-04-05 18:11:10 +02:00
|
|
|
IconNameStory.storyName = 'IconName';
|
|
|
|
|
2023-07-13 22:22:40 +02:00
|
|
|
export const SizeStory: StoryFn<typeof ButtonIcon> = (args) => (
|
2023-04-12 17:55:24 +02:00
|
|
|
<>
|
2023-08-03 21:23:47 +02:00
|
|
|
<ButtonIcon {...args} size={ButtonIconSize.Sm} />
|
|
|
|
<ButtonIcon {...args} size={ButtonIconSize.Md} />
|
|
|
|
<ButtonIcon {...args} size={ButtonIconSize.Lg} />
|
2023-04-12 17:55:24 +02:00
|
|
|
</>
|
2022-11-09 22:57:21 +01:00
|
|
|
);
|
|
|
|
|
2023-02-02 21:15:26 +01:00
|
|
|
SizeStory.storyName = 'Size';
|
|
|
|
|
2023-07-13 22:22:40 +02:00
|
|
|
export const AriaLabel: StoryFn<typeof ButtonIcon> = (args) => (
|
2022-11-09 22:57:21 +01:00
|
|
|
<>
|
2023-08-03 21:23:47 +02:00
|
|
|
<ButtonIcon {...args} />
|
2022-11-09 22:57:21 +01:00
|
|
|
<ButtonIcon
|
2023-07-13 22:22:40 +02:00
|
|
|
{...args}
|
2022-11-09 22:57:21 +01:00
|
|
|
as="a"
|
|
|
|
href="https://metamask.io/"
|
|
|
|
target="_blank"
|
2023-07-13 22:22:40 +02:00
|
|
|
color={IconColor.primaryDefault}
|
2023-04-05 18:11:10 +02:00
|
|
|
iconName={IconName.Export}
|
2022-11-09 22:57:21 +01:00
|
|
|
ariaLabel="Visit MetaMask.io"
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
|
2023-07-13 22:22:40 +02:00
|
|
|
export const As: StoryFn<typeof ButtonIcon> = (args) => (
|
2023-04-12 17:55:24 +02:00
|
|
|
<>
|
2023-08-03 21:23:47 +02:00
|
|
|
<ButtonIcon {...args} />
|
2022-11-09 22:57:21 +01:00
|
|
|
<ButtonIcon
|
2023-08-03 21:23:47 +02:00
|
|
|
{...args}
|
2022-11-09 22:57:21 +01:00
|
|
|
as="a"
|
|
|
|
href="#"
|
2023-07-13 22:22:40 +02:00
|
|
|
color={IconColor.primaryDefault}
|
2023-04-05 18:11:10 +02:00
|
|
|
iconName={IconName.Export}
|
2022-12-01 18:26:31 +01:00
|
|
|
ariaLabel="demo"
|
2022-11-09 22:57:21 +01:00
|
|
|
/>
|
2023-04-12 17:55:24 +02:00
|
|
|
</>
|
2022-11-09 22:57:21 +01:00
|
|
|
);
|
|
|
|
|
2023-07-13 22:22:40 +02:00
|
|
|
export const Href: StoryFn<typeof ButtonIcon> = (args) => (
|
2023-08-03 21:23:47 +02:00
|
|
|
<ButtonIcon {...args} />
|
2022-11-09 22:57:21 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
Href.args = {
|
2022-12-01 18:26:31 +01:00
|
|
|
ariaLabel: 'Visit Metamask.io',
|
2022-11-09 22:57:21 +01:00
|
|
|
href: 'https://metamask.io/',
|
2023-08-03 21:23:47 +02:00
|
|
|
target: '_blank',
|
2023-07-13 22:22:40 +02:00
|
|
|
color: IconColor.primaryDefault,
|
2023-08-03 21:23:47 +02:00
|
|
|
iconName: IconName.Export,
|
2022-11-09 22:57:21 +01:00
|
|
|
};
|
|
|
|
|
2023-07-13 22:22:40 +02:00
|
|
|
export const ColorStory: StoryFn<typeof ButtonIcon> = (args) => (
|
2023-08-03 21:23:47 +02:00
|
|
|
<ButtonIcon {...args} />
|
2022-11-09 22:57:21 +01:00
|
|
|
);
|
2023-02-02 21:15:26 +01:00
|
|
|
ColorStory.storyName = 'Color';
|
2022-11-09 22:57:21 +01:00
|
|
|
|
2023-02-02 21:15:26 +01:00
|
|
|
ColorStory.args = {
|
2023-07-13 22:22:40 +02:00
|
|
|
color: IconColor.primaryDefault,
|
2022-11-09 22:57:21 +01:00
|
|
|
};
|
|
|
|
|
2023-07-13 22:22:40 +02:00
|
|
|
export const Disabled: StoryFn<typeof ButtonIcon> = (args) => (
|
2023-08-03 21:23:47 +02:00
|
|
|
<ButtonIcon {...args} />
|
2022-11-09 22:57:21 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
Disabled.args = {
|
|
|
|
disabled: true,
|
|
|
|
};
|