Skip to content

Commit

Permalink
Update knobs to controls in storybook: SelectQuotePopover (#18671)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
3 people authored Apr 24, 2023
1 parent 8bfcd5b commit db4c431
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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,
Expand All @@ -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}
Expand Down

0 comments on commit db4c431

Please sign in to comment.