1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-23 03:36:18 +02:00
metamask-extension/ui/components/app/advanced-gas-controls/advanced-gas-controls.component.js
Alex Donesky b1e2005a73
Add form-field component and new account view (#11450)
* add generic form-field component

* swap in new form-field component for advanced-gas-controls-row

* add new create password view for redesigned onboarding flow

* make text additions translatable
2021-07-06 17:19:11 -05:00

99 lines
2.6 KiB
JavaScript

import React, { useContext, useState } from 'react';
import { I18nContext } from '../../../contexts/i18n';
import Typography from '../../ui/typography/typography';
import {
FONT_WEIGHT,
TYPOGRAPHY,
COLORS,
} from '../../../helpers/constants/design-system';
import FormField from '../../ui/form-field';
export default function AdvancedGasControls() {
const t = useContext(I18nContext);
const [gasLimit, setGasLimit] = useState(0);
const [maxPriorityFee, setMaxPriorityFee] = useState(0);
const [maxFee, setMaxFee] = useState(0);
// Used in legacy version
const [gasPrice, setGasPrice] = useState(0);
return (
<div className="advanced-gas-controls">
<FormField
titleText={t('gasLimit')}
onChange={setGasLimit}
tooltipText=""
value={gasLimit}
numeric
/>
{process.env.SHOW_EIP_1559_UI ? (
<>
<FormField
titleText={t('maxPriorityFee')}
titleUnit="(GWEI)"
tooltipText=""
onChange={setMaxPriorityFee}
value={maxPriorityFee}
numeric
titleDetail={
<>
<Typography
tag="span"
color={COLORS.UI4}
variant={TYPOGRAPHY.H8}
fontWeight={FONT_WEIGHT.BOLD}
>
{t('gasFeeEstimate')}:
</Typography>{' '}
<Typography
tag="span"
color={COLORS.UI4}
variant={TYPOGRAPHY.H8}
></Typography>
</>
}
/>
<FormField
titleText={t('maxFee')}
titleUnit="(GWEI)"
tooltipText=""
onChange={setMaxFee}
value={maxFee}
numeric
titleDetail={
<>
<Typography
tag="span"
color={COLORS.UI4}
variant={TYPOGRAPHY.H8}
fontWeight={FONT_WEIGHT.BOLD}
>
{t('gasFeeEstimate')}:
</Typography>{' '}
<Typography
tag="span"
color={COLORS.UI4}
variant={TYPOGRAPHY.H8}
></Typography>
</>
}
/>
</>
) : (
<>
<FormField
titleText={t('gasPrice')}
titleUnit="(GWEI)"
onChange={setGasPrice}
tooltipText={t('editGasPriceTooltip')}
value={gasPrice}
numeric
/>
</>
)}
</div>
);
}