1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-25 11:28:51 +01:00
metamask-extension/ui/components/component-library/modal-overlay/modal-overlay.stories.tsx
jainex d879f08763
Update ModalOverlay to use TS Box version (#20203)
* Update ModalOverlay to use TS Box version

* fix jest error

* lint error fix

* Fix lint errors and improve ModalOverlay's TypeScript typings

* Some small updates to story and docs

---------

Co-authored-by: georgewrmarshall <george.marshall@consensys.net>
2023-08-01 14:39:08 -07:00

45 lines
988 B
TypeScript

import React, { useState } from 'react';
import { StoryFn, Meta } from '@storybook/react';
import { ModalOverlay } from './modal-overlay';
import README from './README.mdx';
export default {
title: 'Components/ComponentLibrary/ModalOverlay',
component: ModalOverlay,
parameters: {
docs: {
page: README,
},
},
argTypes: {
className: {
control: 'text',
},
onClick: {
action: 'onClick',
},
},
} as Meta<typeof ModalOverlay>;
const Template: StoryFn<typeof ModalOverlay> = (args) => (
<ModalOverlay {...args} />
);
export const DefaultStory = Template.bind({});
DefaultStory.storyName = 'Default';
export const OnClick: StoryFn<typeof ModalOverlay> = (args) => {
const [open, setOpen] = useState(false);
const handleOnClick = () => {
setOpen(!open);
};
return (
<>
<button onClick={handleOnClick}>Show modal overlay</button>
{open && <ModalOverlay {...args} onClick={handleOnClick} />}
</>
);
};