From db4c4317dd32ce46566ff18625dc12b1e5ba54f6 Mon Sep 17 00:00:00 2001 From: "sumit shinde ( Roni )" <110285294+sumitshinde-84@users.noreply.github.com> Date: Mon, 24 Apr 2023 14:48:14 +0530 Subject: [PATCH] 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 --------- Co-authored-by: George Marshall Co-authored-by: George Marshall --- .../select-quote-popover.stories.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/ui/pages/swaps/select-quote-popover/select-quote-popover.stories.js b/ui/pages/swaps/select-quote-popover/select-quote-popover.stories.js index 0da8e42c3a0a..69bedcce5e35 100644 --- a/ui/pages/swaps/select-quote-popover/select-quote-popover.stories.js +++ b/ui/pages/swaps/select-quote-popover/select-quote-popover.stories.js @@ -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 (
{showPopover && ( setShowPopover(false)} - onSubmit={action('submit SelectQuotePopover')} + onSubmit={handleSubmit} swapToSymbol={args.swapToSymbol || 'DAI'} initialAggId={args.initialAggId || 'Agg4'} hideEstimatedGasFee={args.hideEstimatedGasFee || false}