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

96 lines
2.7 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,
GAS_RECOMMENDATIONS,
} from '../../../../shared/constants/gas';
import EditGasPopover from '.';
2021-09-24 03:40:03 +02:00
const store = configureStore(testData);
export default {
title: 'Components/App/EditGasPopover',
2021-09-24 03:40:03 +02:00
decorators: [(story) => <Provider store={store}>{story()}</Provider>],
id: __filename,
};
export const DefaultStory = () => {
return (
<div style={{ width: '600px' }}>
2021-09-24 03:40:03 +02:00
<EditGasPopover
transaction={{
userFeeLevel: GAS_RECOMMENDATIONS.MEDIUM,
2021-09-24 03:40:03 +02:00
txParams: {
maxFeePerGas: decGWEIToHexWEI('10000'),
maxPriorityFeePerGas: '0x5600',
gas: `0x5600`,
gasPrice: '0x5600',
},
}}
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"
/>
</div>
);
};
DefaultStory.storyName = 'Default';
export const WithDifferentButtonText = () => {
return (
<div style={{ width: '600px' }}>
2021-09-24 03:40:03 +02:00
<EditGasPopover
confirmButtonText="Custom Value"
transaction={{
userFeeLevel: GAS_RECOMMENDATIONS.MEDIUM,
2021-09-24 03:40:03 +02:00
txParams: {
maxFeePerGas: decGWEIToHexWEI('10000'),
maxPriorityFeePerGas: '0x5600',
gas: `0x5600`,
gasPrice: '0x5600',
},
}}
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"
/>
</div>
);
};
export const WithEducationalContentFlow = () => {
return (
<div style={{ width: '600px' }}>
2021-09-24 03:40:03 +02:00
<EditGasPopover
editGasDisplayProps={{
showEducationButton: boolean('Show Education Button', true),
}}
transaction={{
userFeeLevel: GAS_RECOMMENDATIONS.MEDIUM,
2021-09-24 03:40:03 +02:00
txParams: {
maxFeePerGas: decGWEIToHexWEI('10000'),
maxPriorityFeePerGas: '0x5600',
gas: `0x5600`,
gasPrice: '0x5600',
},
}}
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"
/>
</div>
);
};