1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00
metamask-extension/ui/components/component-library/popover-header/popover-header.stories.tsx
Garrett Bear 66292330fe
Feat/18890/button ts update (#20492)
* button to TS migration

working demo

style props

broken mapping - need switch

working types file

working types

fix dependent imports of Button

variant mapping

working types

fix lint

fix test

fix ButtonSize issue on QuizContent

box fix

test if this works

fix button being used on QuizContent

fix button_variant import

readme fix

* fix button import

* fix primary button as anchor hover

* deprecated

* button to TS migration

fix lint

fix test

* fix rebase issue

* fix rebase issue

* lint fix
2023-08-28 14:42:00 -07:00

87 lines
2.1 KiB
TypeScript

import React from 'react';
import { ComponentStory, ComponentMeta } from '@storybook/react';
import {
TextVariant,
TextAlign,
DISPLAY,
FLEX_DIRECTION,
AlignItems,
JustifyContent,
} from '../../../helpers/constants/design-system';
import { AvatarAccount, ButtonSize, Button, Text } from '..';
import { PopoverHeader } from './popover-header';
import README from './README.mdx';
export default {
title: 'Components/ComponentLibrary/PopoverHeader',
component: PopoverHeader,
parameters: {
docs: {
page: README,
},
},
argTypes: {
children: { control: 'text' },
className: { control: 'text' },
onBack: { action: 'onBack' },
onClose: { action: 'onClose' },
},
args: {
children: 'PopoverHeader',
},
} as ComponentMeta<typeof PopoverHeader>;
const Template: ComponentStory<typeof PopoverHeader> = (args) => {
return <PopoverHeader {...args} />;
};
export const DefaultStory = Template.bind({});
DefaultStory.storyName = 'Default';
export const Children: ComponentStory<typeof PopoverHeader> = (args) => (
<>
<PopoverHeader {...args} marginBottom={4}>
Children as string
</PopoverHeader>
<PopoverHeader
{...args}
childrenWrapperProps={{
display: DISPLAY.FLEX,
flexDirection: FLEX_DIRECTION.COLUMN,
alignItems: AlignItems.center,
justifyContent: JustifyContent.center,
}}
>
<AvatarAccount address="0x1234" />
<Text variant={TextVariant.headingSm} textAlign={TextAlign.Center}>
Custom header using multiple components
</Text>
</PopoverHeader>
</>
);
export const OnBack = Template.bind({});
OnBack.args = {
children: 'OnBack demo',
};
export const OnClose = Template.bind({});
OnClose.args = {
children: 'OnClose demo',
};
export const StartAccessory = Template.bind({});
StartAccessory.args = {
children: 'StartAccessory demo',
startAccessory: <Button size={ButtonSize.Sm}>Demo</Button>,
};
export const EndAccessory = Template.bind({});
EndAccessory.args = {
children: 'EndAccessory demo',
endAccessory: <Button size={ButtonSize.Sm}>Demo</Button>,
};