2022-11-09 22:57:21 +01:00
|
|
|
import React from 'react';
|
2023-04-12 17:55:24 +02:00
|
|
|
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
|
|
import { Color } 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',
|
2023-01-20 20:27:46 +01:00
|
|
|
|
2022-11-09 22:57:21 +01:00
|
|
|
component: ButtonIcon,
|
|
|
|
parameters: {
|
|
|
|
docs: {
|
|
|
|
page: README,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
argTypes: {
|
|
|
|
as: {
|
|
|
|
control: 'select',
|
|
|
|
options: ['button', 'a'],
|
|
|
|
},
|
|
|
|
},
|
2023-04-12 17:55:24 +02:00
|
|
|
} as ComponentMeta<typeof ButtonIcon>;
|
2022-11-09 22:57:21 +01:00
|
|
|
|
2023-04-12 17:55:24 +02:00
|
|
|
const Template: ComponentStory<typeof ButtonIcon> = (args) => (
|
|
|
|
<ButtonIcon {...args} />
|
|
|
|
);
|
|
|
|
|
|
|
|
export const DefaultStory = Template.bind({});
|
2022-11-09 22:57:21 +01:00
|
|
|
|
|
|
|
DefaultStory.args = {
|
2023-04-05 18:11:10 +02:00
|
|
|
iconName: IconName.Close,
|
2022-11-09 22:57:21 +01:00
|
|
|
ariaLabel: 'Close',
|
|
|
|
};
|
|
|
|
|
|
|
|
DefaultStory.storyName = 'Default';
|
|
|
|
|
2023-04-12 17:55:24 +02:00
|
|
|
export const IconNameStory: ComponentStory<typeof ButtonIcon> = (args) => (
|
|
|
|
<ButtonIcon {...args} />
|
|
|
|
);
|
2022-12-01 18:26:31 +01:00
|
|
|
|
2023-04-05 18:11:10 +02:00
|
|
|
IconNameStory.args = {
|
|
|
|
iconName: IconName.Close,
|
2022-12-01 18:26:31 +01:00
|
|
|
ariaLabel: 'Close',
|
|
|
|
};
|
2022-11-09 22:57:21 +01:00
|
|
|
|
2023-04-05 18:11:10 +02:00
|
|
|
IconNameStory.storyName = 'IconName';
|
|
|
|
|
2023-04-12 17:55:24 +02:00
|
|
|
export const SizeStory: ComponentStory<typeof ButtonIcon> = (args) => (
|
|
|
|
<>
|
2022-11-09 22:57:21 +01:00
|
|
|
<ButtonIcon
|
|
|
|
{...args}
|
2023-04-12 17:55:24 +02:00
|
|
|
size={ButtonIconSize.Sm}
|
2023-04-05 18:11:10 +02:00
|
|
|
iconName={IconName.Close}
|
2022-11-09 22:57:21 +01:00
|
|
|
ariaLabel="Close"
|
|
|
|
/>
|
|
|
|
<ButtonIcon
|
|
|
|
{...args}
|
2023-04-12 17:55:24 +02:00
|
|
|
size={ButtonIconSize.Lg}
|
2023-02-02 21:15:26 +01:00
|
|
|
color={Color.primaryDefault}
|
2023-04-05 18:11:10 +02:00
|
|
|
iconName={IconName.Close}
|
2022-11-09 22:57:21 +01:00
|
|
|
ariaLabel="Close"
|
|
|
|
/>
|
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-04-12 17:55:24 +02:00
|
|
|
export const AriaLabel: ComponentStory<typeof ButtonIcon> = (args) => (
|
2022-11-09 22:57:21 +01:00
|
|
|
<>
|
|
|
|
<ButtonIcon
|
|
|
|
as="button"
|
2023-04-05 18:11:10 +02:00
|
|
|
iconName={IconName.Close}
|
2022-11-09 22:57:21 +01:00
|
|
|
ariaLabel="Close"
|
|
|
|
{...args}
|
|
|
|
/>
|
|
|
|
<ButtonIcon
|
|
|
|
as="a"
|
|
|
|
href="https://metamask.io/"
|
|
|
|
target="_blank"
|
2023-02-02 21:15:26 +01:00
|
|
|
color={Color.primaryDefault}
|
2023-04-05 18:11:10 +02:00
|
|
|
iconName={IconName.Export}
|
2022-11-09 22:57:21 +01:00
|
|
|
ariaLabel="Visit MetaMask.io"
|
|
|
|
{...args}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
|
2023-04-12 17:55:24 +02:00
|
|
|
export const As: ComponentStory<typeof ButtonIcon> = (args) => (
|
|
|
|
<>
|
2023-04-05 18:11:10 +02:00
|
|
|
<ButtonIcon {...args} iconName={IconName.Close} ariaLabel="close" />
|
2022-11-09 22:57:21 +01:00
|
|
|
<ButtonIcon
|
|
|
|
as="a"
|
|
|
|
href="#"
|
|
|
|
{...args}
|
2023-02-02 21:15:26 +01:00
|
|
|
color={Color.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-04-12 17:55:24 +02:00
|
|
|
export const Href: ComponentStory<typeof ButtonIcon> = (args) => (
|
2023-04-05 18:11:10 +02:00
|
|
|
<ButtonIcon iconName={IconName.Export} {...args} target="_blank" />
|
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-02-02 21:15:26 +01:00
|
|
|
color: Color.primaryDefault,
|
2022-11-09 22:57:21 +01:00
|
|
|
};
|
|
|
|
|
2023-04-12 17:55:24 +02:00
|
|
|
export const ColorStory: ComponentStory<typeof ButtonIcon> = (args) => (
|
2023-04-05 18:11:10 +02:00
|
|
|
<ButtonIcon {...args} iconName={IconName.Close} ariaLabel="close" />
|
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 = {
|
|
|
|
color: Color.primaryDefault,
|
2022-11-09 22:57:21 +01:00
|
|
|
};
|
|
|
|
|
2023-04-12 17:55:24 +02:00
|
|
|
export const Disabled: ComponentStory<typeof ButtonIcon> = (args) => (
|
2023-04-05 18:11:10 +02:00
|
|
|
<ButtonIcon {...args} iconName={IconName.Close} ariaLabel="close" />
|
2022-11-09 22:57:21 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
Disabled.args = {
|
|
|
|
disabled: true,
|
|
|
|
};
|