2023-04-25 23:27:54 +02:00
|
|
|
import React from 'react';
|
2023-05-31 19:12:21 +02:00
|
|
|
import { StoryFn, Meta } from '@storybook/react';
|
2023-04-25 23:27:54 +02:00
|
|
|
|
|
|
|
import {
|
|
|
|
TextVariant,
|
|
|
|
TextAlign,
|
2023-05-31 19:12:21 +02:00
|
|
|
Display,
|
|
|
|
FlexDirection,
|
2023-04-25 23:27:54 +02:00
|
|
|
AlignItems,
|
|
|
|
JustifyContent,
|
|
|
|
} from '../../../helpers/constants/design-system';
|
|
|
|
|
2023-07-17 23:00:16 +02:00
|
|
|
import { AvatarAccount, BUTTON_SIZES, Button, Text } from '..';
|
2023-04-25 23:27:54 +02:00
|
|
|
|
|
|
|
import { ModalHeader } from './modal-header';
|
|
|
|
import README from './README.mdx';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
title: 'Components/ComponentLibrary/ModalHeader',
|
|
|
|
component: ModalHeader,
|
|
|
|
parameters: {
|
|
|
|
docs: {
|
|
|
|
page: README,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
argTypes: {
|
|
|
|
children: { control: 'text' },
|
|
|
|
className: { control: 'text' },
|
|
|
|
onBack: { action: 'onBack' },
|
|
|
|
onClose: { action: 'onClose' },
|
|
|
|
},
|
|
|
|
args: {
|
|
|
|
children: 'ModalHeader',
|
|
|
|
},
|
2023-05-31 19:12:21 +02:00
|
|
|
} as Meta<typeof ModalHeader>;
|
2023-04-25 23:27:54 +02:00
|
|
|
|
2023-05-31 19:12:21 +02:00
|
|
|
const Template: StoryFn<typeof ModalHeader> = (args) => {
|
2023-04-25 23:27:54 +02:00
|
|
|
return <ModalHeader {...args} />;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const DefaultStory = Template.bind({});
|
|
|
|
DefaultStory.storyName = 'Default';
|
|
|
|
|
2023-05-31 19:12:21 +02:00
|
|
|
export const Children: StoryFn<typeof ModalHeader> = (args) => (
|
2023-04-25 23:27:54 +02:00
|
|
|
<>
|
|
|
|
<ModalHeader {...args} marginBottom={4}>
|
|
|
|
Children as string
|
|
|
|
</ModalHeader>
|
|
|
|
<ModalHeader
|
|
|
|
{...args}
|
|
|
|
childrenWrapperProps={{
|
2023-05-31 19:12:21 +02:00
|
|
|
display: Display.Flex,
|
|
|
|
flexDirection: FlexDirection.Column,
|
2023-04-25 23:27:54 +02:00
|
|
|
alignItems: AlignItems.center,
|
|
|
|
justifyContent: JustifyContent.center,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<AvatarAccount address="0x1234" />
|
|
|
|
<Text variant={TextVariant.headingSm} textAlign={TextAlign.Center}>
|
|
|
|
Custom header using multiple components
|
|
|
|
</Text>
|
|
|
|
</ModalHeader>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
|
|
|
|
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={BUTTON_SIZES.SM}>Demo</Button>,
|
|
|
|
};
|
|
|
|
|
|
|
|
export const EndAccessory = Template.bind({});
|
|
|
|
EndAccessory.args = {
|
|
|
|
children: 'EndAccessory demo',
|
|
|
|
endAccessory: <Button size={BUTTON_SIZES.SM}>Demo</Button>,
|
|
|
|
};
|