1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-29 15:50:28 +01:00
metamask-extension/ui/pages/swaps/prepare-swap-page/smart-transactions-popover.stories.tsx
infiniteflower 10ffc1ec84
Chore/refactor smart swap modal (#20239)
* Add story for smart tx popover

* Use tsx for smart tx popover story and add btn to open it

* Refactor smart tx popover component to tsx and style

* Fix modal not triggering

* Remove bold from bullet points

* Adjust margins
2023-08-01 15:31:53 +02:00

40 lines
1.2 KiB
TypeScript

import React from 'react';
import { StoryFn, Meta } from '@storybook/react';
import { useArgs } from '@storybook/client-api';
import { BUTTON_VARIANT, Button } from '../../../components/component-library';
import SmartTransactionPopover from './smart-transactions-popover';
export default {
title: 'Pages/Swaps/SmartTransactionsPopover',
component: SmartTransactionPopover,
argTypes: {
isShowingModal: {
control: 'boolean',
},
},
} as Meta<typeof SmartTransactionPopover>;
export const DefaultStory: StoryFn<typeof SmartTransactionPopover> = () => {
const [{ isShowingModal }, updateArgs] = useArgs();
const toggleModal = () => updateArgs({ isShowingModal: !isShowingModal });
return (
<>
<Button variant={BUTTON_VARIANT.PRIMARY} onClick={toggleModal}>
Open modal
</Button>
{isShowingModal && (
<SmartTransactionPopover
isOpen={isShowingModal}
onEnableSmartTransactionsClick={() => {
console.log('onEnableSmartTransactionsClick');
}}
onCloseSmartTransactionsOptInPopover={toggleModal}
/>
)}
</>
);
};
DefaultStory.storyName = 'Default';