import React, { useState, useContext } from 'react'; import PropTypes from 'prop-types'; import Typography from '../../ui/typography/typography'; import { COLORS, TYPOGRAPHY, FONT_WEIGHT, } from '../../../helpers/constants/design-system'; import InfoTooltip from '../../ui/info-tooltip'; import TransactionTotalBanner from '../transaction-total-banner/transaction-total-banner.component'; import RadioGroup from '../../ui/radio-group/radio-group.component'; import AdvancedGasControls from '../advanced-gas-controls/advanced-gas-controls.component'; import { I18nContext } from '../../../contexts/i18n'; import ActionableMessage from '../../../pages/swaps/actionable-message'; export default function EditGasDisplay({ alwaysShowForm, type, showEducationButton, onEducationClick, }) { const t = useContext(I18nContext); const [warning] = useState(null); const [showAdvancedForm, setShowAdvancedForm] = useState(false); return (
{warning && (
)} {type === 'speed-up' && (
{t('speedUpTooltipText')}{' '}
)} {!alwaysShowForm && ( )} {(alwaysShowForm || showAdvancedForm) && }
{showEducationButton && (
)}
); } EditGasDisplay.propTypes = { alwaysShowForm: PropTypes.bool, type: PropTypes.oneOf(['customize-gas', 'speed-up']), showEducationButton: PropTypes.bool, onEducationClick: PropTypes.func, }; EditGasDisplay.defaultProps = { alwaysShowForm: false, type: 'customize-gas', showEducationButton: false, onEducationClick: undefined, };