2021-06-28 16:45:08 +02:00
|
|
|
import React from 'react';
|
2021-09-24 03:40:03 +02:00
|
|
|
import { Provider } from 'react-redux';
|
|
|
|
import { action } from '@storybook/addon-actions';
|
|
|
|
import { boolean } from '@storybook/addon-knobs';
|
|
|
|
import { decGWEIToHexWEI } from '../../../helpers/utils/conversions.util';
|
|
|
|
import configureStore from '../../../store/store';
|
|
|
|
import testData from '../../../../.storybook/test-data';
|
2021-11-06 01:59:23 +01:00
|
|
|
import {
|
|
|
|
EDIT_GAS_MODES,
|
|
|
|
GAS_RECOMMENDATIONS,
|
|
|
|
} from '../../../../shared/constants/gas';
|
|
|
|
|
2021-06-28 16:45:08 +02:00
|
|
|
import EditGasPopover from '.';
|
|
|
|
|
2021-09-24 03:40:03 +02:00
|
|
|
const store = configureStore(testData);
|
|
|
|
|
2021-06-28 16:45:08 +02:00
|
|
|
export default {
|
2021-12-01 20:27:57 +01:00
|
|
|
title: 'Components/App/EditGasPopover',
|
2021-09-24 03:40:03 +02:00
|
|
|
decorators: [(story) => <Provider store={store}>{story()}</Provider>],
|
2021-09-15 20:55:48 +02:00
|
|
|
id: __filename,
|
2021-06-28 16:45:08 +02:00
|
|
|
};
|
|
|
|
|
2021-12-01 20:27:57 +01:00
|
|
|
export const DefaultStory = () => {
|
2021-06-28 16:45:08 +02:00
|
|
|
return (
|
|
|
|
<div style={{ width: '600px' }}>
|
2021-09-24 03:40:03 +02:00
|
|
|
<EditGasPopover
|
|
|
|
transaction={{
|
2021-11-06 01:59:23 +01:00
|
|
|
userFeeLevel: GAS_RECOMMENDATIONS.MEDIUM,
|
2021-09-24 03:40:03 +02:00
|
|
|
txParams: {
|
|
|
|
maxFeePerGas: decGWEIToHexWEI('10000'),
|
|
|
|
maxPriorityFeePerGas: '0x5600',
|
|
|
|
gas: `0x5600`,
|
|
|
|
gasPrice: '0x5600',
|
|
|
|
},
|
|
|
|
}}
|
2021-11-06 01:59:23 +01:00
|
|
|
defaultEstimateToUse={GAS_RECOMMENDATIONS.HIGH}
|
2021-09-24 03:40:03 +02:00
|
|
|
mode={EDIT_GAS_MODES.SWAPS}
|
|
|
|
confirmButtonText="Submit"
|
|
|
|
onClose={() => action(`Close Edit Gas Popover`)()}
|
|
|
|
minimumGasLimit="5700"
|
|
|
|
/>
|
2021-06-28 16:45:08 +02:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2021-12-01 20:27:57 +01:00
|
|
|
DefaultStory.storyName = 'Default';
|
|
|
|
|
|
|
|
export const WithDifferentButtonText = () => {
|
2021-06-28 16:45:08 +02:00
|
|
|
return (
|
|
|
|
<div style={{ width: '600px' }}>
|
2021-09-24 03:40:03 +02:00
|
|
|
<EditGasPopover
|
|
|
|
confirmButtonText="Custom Value"
|
|
|
|
transaction={{
|
2021-11-06 01:59:23 +01:00
|
|
|
userFeeLevel: GAS_RECOMMENDATIONS.MEDIUM,
|
2021-09-24 03:40:03 +02:00
|
|
|
txParams: {
|
|
|
|
maxFeePerGas: decGWEIToHexWEI('10000'),
|
|
|
|
maxPriorityFeePerGas: '0x5600',
|
|
|
|
gas: `0x5600`,
|
|
|
|
gasPrice: '0x5600',
|
|
|
|
},
|
|
|
|
}}
|
2021-11-06 01:59:23 +01:00
|
|
|
defaultEstimateToUse={GAS_RECOMMENDATIONS.HIGH}
|
2021-09-24 03:40:03 +02:00
|
|
|
mode={EDIT_GAS_MODES.SWAPS}
|
|
|
|
onClose={() => action(`Close Edit Gas Popover`)()}
|
|
|
|
minimumGasLimit="5700"
|
|
|
|
/>
|
2021-06-28 16:45:08 +02:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2021-12-01 20:27:57 +01:00
|
|
|
export const WithEducationalContentFlow = () => {
|
2021-06-28 16:45:08 +02:00
|
|
|
return (
|
|
|
|
<div style={{ width: '600px' }}>
|
2021-09-24 03:40:03 +02:00
|
|
|
<EditGasPopover
|
|
|
|
editGasDisplayProps={{
|
|
|
|
showEducationButton: boolean('Show Education Button', true),
|
|
|
|
}}
|
|
|
|
transaction={{
|
2021-11-06 01:59:23 +01:00
|
|
|
userFeeLevel: GAS_RECOMMENDATIONS.MEDIUM,
|
2021-09-24 03:40:03 +02:00
|
|
|
txParams: {
|
|
|
|
maxFeePerGas: decGWEIToHexWEI('10000'),
|
|
|
|
maxPriorityFeePerGas: '0x5600',
|
|
|
|
gas: `0x5600`,
|
|
|
|
gasPrice: '0x5600',
|
|
|
|
},
|
|
|
|
}}
|
2021-11-06 01:59:23 +01:00
|
|
|
defaultEstimateToUse={GAS_RECOMMENDATIONS.HIGH}
|
2021-09-24 03:40:03 +02:00
|
|
|
mode={EDIT_GAS_MODES.SWAPS}
|
|
|
|
confirmButtonText="Submit"
|
|
|
|
onClose={() => action(`Close Edit Gas Popover`)()}
|
|
|
|
minimumGasLimit="5700"
|
|
|
|
/>
|
2021-06-28 16:45:08 +02:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|