1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-12 04:37:13 +01:00
metamask-extension/ui/components/app/edit-gas-popover/edit-gas-popover.stories.js

90 lines
2.5 KiB
JavaScript
Raw Normal View History

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';
import { EDIT_GAS_MODES } from '../../../../shared/constants/gas';
import EditGasPopover from '.';
2021-09-24 03:40:03 +02:00
const store = configureStore(testData);
export default {
title: 'Edit Gas Display Popover',
2021-09-24 03:40:03 +02:00
decorators: [(story) => <Provider store={store}>{story()}</Provider>],
id: __filename,
};
2021-09-24 03:40:03 +02:00
export const Basic = () => {
return (
<div style={{ width: '600px' }}>
2021-09-24 03:40:03 +02:00
<EditGasPopover
transaction={{
userFeeLevel: 'medium',
txParams: {
maxFeePerGas: decGWEIToHexWEI('10000'),
maxPriorityFeePerGas: '0x5600',
gas: `0x5600`,
gasPrice: '0x5600',
},
}}
defaultEstimateToUse="high"
mode={EDIT_GAS_MODES.SWAPS}
confirmButtonText="Submit"
onClose={() => action(`Close Edit Gas Popover`)()}
minimumGasLimit="5700"
/>
</div>
);
};
2021-09-24 03:40:03 +02:00
export const BasicWithDifferentButtonText = () => {
return (
<div style={{ width: '600px' }}>
2021-09-24 03:40:03 +02:00
<EditGasPopover
confirmButtonText="Custom Value"
transaction={{
userFeeLevel: 'medium',
txParams: {
maxFeePerGas: decGWEIToHexWEI('10000'),
maxPriorityFeePerGas: '0x5600',
gas: `0x5600`,
gasPrice: '0x5600',
},
}}
defaultEstimateToUse="high"
mode={EDIT_GAS_MODES.SWAPS}
onClose={() => action(`Close Edit Gas Popover`)()}
minimumGasLimit="5700"
/>
</div>
);
};
2021-09-24 03:40:03 +02:00
export const EducationalContentFlow = () => {
return (
<div style={{ width: '600px' }}>
2021-09-24 03:40:03 +02:00
<EditGasPopover
editGasDisplayProps={{
showEducationButton: boolean('Show Education Button', true),
}}
transaction={{
userFeeLevel: 'medium',
txParams: {
maxFeePerGas: decGWEIToHexWEI('10000'),
maxPriorityFeePerGas: '0x5600',
gas: `0x5600`,
gasPrice: '0x5600',
},
}}
defaultEstimateToUse="high"
mode={EDIT_GAS_MODES.SWAPS}
confirmButtonText="Submit"
onClose={() => action(`Close Edit Gas Popover`)()}
minimumGasLimit="5700"
/>
</div>
);
};