2021-02-04 19:15:23 +01:00
|
|
|
import React from 'react';
|
|
|
|
import { action } from '@storybook/addon-actions';
|
|
|
|
import { text, boolean, number, object } from '@storybook/addon-knobs';
|
2021-09-24 16:47:40 +02:00
|
|
|
import { MAINNET_CHAIN_ID } from '../../../../shared/constants/network';
|
2021-02-04 19:15:23 +01:00
|
|
|
import FeeCard from './fee-card';
|
2020-10-06 20:28:38 +02:00
|
|
|
|
2020-10-16 17:59:32 +02:00
|
|
|
const tokenApprovalTextComponent = (
|
2021-12-07 04:51:26 +01:00
|
|
|
<span key="fee-card-approve-symbol" className="view-quote__bold">
|
2020-10-16 17:59:32 +02:00
|
|
|
ABC
|
|
|
|
</span>
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2020-10-16 17:59:32 +02:00
|
|
|
|
2020-10-06 20:28:38 +02:00
|
|
|
const containerStyle = {
|
|
|
|
width: '300px',
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-10-06 20:28:38 +02:00
|
|
|
|
|
|
|
export default {
|
2021-12-01 20:27:57 +01:00
|
|
|
title: 'Pages/Swaps/FeeCard',
|
2021-09-15 20:55:48 +02:00
|
|
|
id: __filename,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-10-06 20:28:38 +02:00
|
|
|
|
|
|
|
export const WithAllProps = () => {
|
|
|
|
return (
|
|
|
|
<div style={containerStyle}>
|
|
|
|
<FeeCard
|
|
|
|
feeRowText={text('feeRowText', 'Network fees')}
|
2020-11-03 00:41:28 +01:00
|
|
|
primaryFee={{
|
2020-10-06 20:28:38 +02:00
|
|
|
fee: text('primaryFee', '1 ETH'),
|
|
|
|
maxFee: text('primaryMaxFee', '2 ETH'),
|
2020-11-03 00:41:28 +01:00
|
|
|
}}
|
|
|
|
secondaryFee={{
|
2020-10-06 20:28:38 +02:00
|
|
|
fee: text('secondaryFee', '100 USD'),
|
|
|
|
maxFee: text('secondaryMaxFee', '200 USD'),
|
2020-11-03 00:41:28 +01:00
|
|
|
}}
|
2021-09-24 16:47:40 +02:00
|
|
|
chainId={MAINNET_CHAIN_ID}
|
|
|
|
networkAndAccountSupports1559={false}
|
2020-10-16 17:59:32 +02:00
|
|
|
onFeeCardMaxRowClick={action('Clicked max fee row link')}
|
|
|
|
tokenApprovalTextComponent={tokenApprovalTextComponent}
|
|
|
|
tokenApprovalSourceTokenSymbol="ABC"
|
|
|
|
onTokenApprovalClick={action('Clicked third row link')}
|
|
|
|
hideTokenApprovalRow={false}
|
2020-12-08 17:47:53 +01:00
|
|
|
metaMaskFee="0.875"
|
|
|
|
savings={object('savings 1', { total: '8.55' })}
|
|
|
|
onQuotesClick={action('Clicked quotes link')}
|
|
|
|
numberOfQuotes={number('numberOfQuotes', 6)}
|
|
|
|
isBestQuote={boolean('isBestQuote', true)}
|
|
|
|
conversionRate={300}
|
|
|
|
currentCurrency="usd"
|
2020-10-06 20:28:38 +02:00
|
|
|
/>
|
|
|
|
</div>
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
|
|
|
};
|
2020-10-06 20:28:38 +02:00
|
|
|
|
|
|
|
export const WithoutThirdRow = () => {
|
|
|
|
return (
|
|
|
|
<div style={containerStyle}>
|
|
|
|
<FeeCard
|
|
|
|
feeRowText={text('feeRowText', 'Network fees')}
|
2020-11-03 00:41:28 +01:00
|
|
|
primaryFee={{
|
2020-10-06 20:28:38 +02:00
|
|
|
fee: text('primaryFee', '1 ETH'),
|
|
|
|
maxFee: text('primaryMaxFee', '2 ETH'),
|
2020-11-03 00:41:28 +01:00
|
|
|
}}
|
|
|
|
secondaryFee={{
|
2020-10-06 20:28:38 +02:00
|
|
|
fee: text('secondaryFee', '100 USD'),
|
|
|
|
maxFee: text('secondaryMaxFee', '200 USD'),
|
2020-11-03 00:41:28 +01:00
|
|
|
}}
|
2020-10-16 17:59:32 +02:00
|
|
|
onFeeCardMaxRowClick={action('Clicked max fee row link')}
|
|
|
|
hideTokenApprovalRow
|
2020-12-08 17:47:53 +01:00
|
|
|
onQuotesClick={action('Clicked quotes link')}
|
|
|
|
numberOfQuotes={number('numberOfQuotes', 1)}
|
|
|
|
isBestQuote={boolean('isBestQuote', true)}
|
|
|
|
savings={object('savings 1', { total: '8.55' })}
|
|
|
|
metaMaskFee="0.875"
|
2021-09-24 16:47:40 +02:00
|
|
|
chainId={MAINNET_CHAIN_ID}
|
|
|
|
networkAndAccountSupports1559={false}
|
2020-10-06 20:28:38 +02:00
|
|
|
/>
|
|
|
|
</div>
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
|
|
|
};
|
2020-10-06 20:28:38 +02:00
|
|
|
|
|
|
|
export const WithOnlyRequiredProps = () => {
|
|
|
|
return (
|
|
|
|
<div style={containerStyle}>
|
|
|
|
<FeeCard
|
2020-11-03 00:41:28 +01:00
|
|
|
primaryFee={{
|
2020-10-06 20:28:38 +02:00
|
|
|
fee: text('primaryFee', '1 ETH'),
|
|
|
|
maxFee: text('primaryMaxFee', '2 ETH'),
|
2020-11-03 00:41:28 +01:00
|
|
|
}}
|
2020-10-16 17:59:32 +02:00
|
|
|
onFeeCardMaxRowClick={action('Clicked max fee row link')}
|
|
|
|
hideTokenApprovalRow
|
2020-12-08 17:47:53 +01:00
|
|
|
metaMaskFee="0.875"
|
|
|
|
onQuotesClick={action('Clicked quotes link')}
|
|
|
|
numberOfQuotes={2}
|
2021-09-24 16:47:40 +02:00
|
|
|
chainId={MAINNET_CHAIN_ID}
|
|
|
|
networkAndAccountSupports1559={false}
|
2020-10-06 20:28:38 +02:00
|
|
|
/>
|
|
|
|
</div>
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
|
|
|
};
|