1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00
metamask-extension/ui/components/component-library/button-icon/button-icon.stories.tsx
Monalisha Mishra b46501cc0d
migration of button icon to use TS box version (#20227)
* migration of button icon to use TS box version

* fixed lint issues

* Some convention and linting updates

* README fixes

* Updating snapshot

* snapshot updates

---------

Co-authored-by: georgewrmarshall <george.marshall@consensys.net>
2023-08-03 12:23:47 -07:00

108 lines
2.4 KiB
TypeScript

import React from 'react';
import { StoryFn, Meta } from '@storybook/react';
import { IconColor } from '../../../helpers/constants/design-system';
import { IconName } from '..';
import { ButtonIconSize } from './button-icon.types';
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'],
},
},
args: {
iconName: IconName.Close,
ariaLabel: 'Close',
},
} as Meta<typeof ButtonIcon>;
const Template: StoryFn<typeof ButtonIcon> = (args) => <ButtonIcon {...args} />;
export const DefaultStory = Template.bind({});
DefaultStory.storyName = 'Default';
export const IconNameStory: StoryFn<typeof ButtonIcon> = (args) => (
<ButtonIcon {...args} />
);
IconNameStory.storyName = 'IconName';
export const SizeStory: StoryFn<typeof ButtonIcon> = (args) => (
<>
<ButtonIcon {...args} size={ButtonIconSize.Sm} />
<ButtonIcon {...args} size={ButtonIconSize.Md} />
<ButtonIcon {...args} size={ButtonIconSize.Lg} />
</>
);
SizeStory.storyName = 'Size';
export const AriaLabel: StoryFn<typeof ButtonIcon> = (args) => (
<>
<ButtonIcon {...args} />
<ButtonIcon
{...args}
as="a"
href="https://metamask.io/"
target="_blank"
color={IconColor.primaryDefault}
iconName={IconName.Export}
ariaLabel="Visit MetaMask.io"
/>
</>
);
export const As: StoryFn<typeof ButtonIcon> = (args) => (
<>
<ButtonIcon {...args} />
<ButtonIcon
{...args}
as="a"
href="#"
color={IconColor.primaryDefault}
iconName={IconName.Export}
ariaLabel="demo"
/>
</>
);
export const Href: StoryFn<typeof ButtonIcon> = (args) => (
<ButtonIcon {...args} />
);
Href.args = {
ariaLabel: 'Visit Metamask.io',
href: 'https://metamask.io/',
target: '_blank',
color: IconColor.primaryDefault,
iconName: IconName.Export,
};
export const ColorStory: StoryFn<typeof ButtonIcon> = (args) => (
<ButtonIcon {...args} />
);
ColorStory.storyName = 'Color';
ColorStory.args = {
color: IconColor.primaryDefault,
};
export const Disabled: StoryFn<typeof ButtonIcon> = (args) => (
<ButtonIcon {...args} />
);
Disabled.args = {
disabled: true,
};