mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Update knobs to controls in storybook: SelectQuotePopover (#18671)
* Update knobs to controls in storybook: SelectQuotePopover * Update select-quote-popover.stories.js * Update select-quote-popover.stories.js * fix eslint * Update ui/pages/swaps/select-quote-popover/select-quote-popover.stories.js Co-authored-by: George Marshall <georgewrmarshall@gmail.com> --------- Co-authored-by: George Marshall <georgewrmarshall@gmail.com> Co-authored-by: George Marshall <george.marshall@consensys.net>
This commit is contained in:
parent
8bfcd5b11e
commit
db4c4317dd
@ -1,6 +1,4 @@
|
||||
import React, { useState } from 'react';
|
||||
import { action } from '@storybook/addon-actions';
|
||||
import { object } from '@storybook/addon-knobs';
|
||||
import Button from '../../../components/ui/button';
|
||||
import mockQuoteData from './mock-quote-data';
|
||||
import README from './README.mdx';
|
||||
@ -29,11 +27,16 @@ export default {
|
||||
options: ['Agg1', 'Agg2', 'Agg3', 'Agg4', 'Agg5', 'Agg6'],
|
||||
},
|
||||
quoteDataRows: {
|
||||
control: 'object',
|
||||
control: {
|
||||
type: 'object',
|
||||
},
|
||||
},
|
||||
hideEstimatedGasFee: {
|
||||
control: 'boolean',
|
||||
},
|
||||
onSubmit: {
|
||||
action: 'onSubmit',
|
||||
},
|
||||
},
|
||||
args: {
|
||||
quoteDataRows: mockQuoteData,
|
||||
@ -43,14 +46,19 @@ export default {
|
||||
export const DefaultStory = (args) => {
|
||||
const [showPopover, setShowPopover] = useState(false);
|
||||
|
||||
const handleSubmit = () => {
|
||||
setShowPopover(false);
|
||||
args.onSubmit();
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Button onClick={() => setShowPopover(true)}>Open Popover</Button>
|
||||
{showPopover && (
|
||||
<SelectQuotePopover
|
||||
quoteDataRows={object('quoteDataRows', mockQuoteData)}
|
||||
quoteDataRows={args.quoteDataRows}
|
||||
onClose={() => setShowPopover(false)}
|
||||
onSubmit={action('submit SelectQuotePopover')}
|
||||
onSubmit={handleSubmit}
|
||||
swapToSymbol={args.swapToSymbol || 'DAI'}
|
||||
initialAggId={args.initialAggId || 'Agg4'}
|
||||
hideEstimatedGasFee={args.hideEstimatedGasFee || false}
|
||||
|
Loading…
Reference in New Issue
Block a user