1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-23 20:05:27 +02:00
metamask-extension/ui/app/components/send/send-content/send-gas-row/send-gas-row.component.js

66 lines
1.8 KiB
JavaScript
Raw Normal View History

2018-04-11 16:21:54 +02:00
import React, { Component } from 'react'
import PropTypes from 'prop-types'
2018-05-15 14:29:23 +02:00
import SendRowWrapper from '../send-row-wrapper/'
import GasFeeDisplay from './gas-fee-display/gas-fee-display.component'
import GasPriceButtonGroup from '../../../gas-customization/gas-price-button-group'
2018-04-11 16:21:54 +02:00
export default class SendGasRow extends Component {
static propTypes = {
2018-04-26 18:38:38 +02:00
conversionRate: PropTypes.number,
convertedCurrency: PropTypes.string,
2018-06-29 19:19:40 +02:00
gasFeeError: PropTypes.bool,
gasLoadingError: PropTypes.bool,
gasTotal: PropTypes.string,
2018-04-27 12:41:18 +02:00
showCustomizeGasModal: PropTypes.func,
}
2018-04-11 16:21:54 +02:00
static contextTypes = {
t: PropTypes.func,
}
2018-04-11 16:21:54 +02:00
render () {
const {
conversionRate,
convertedCurrency,
gasLoadingError,
gasTotal,
2018-06-29 19:19:40 +02:00
gasFeeError,
showCustomizeGasModal,
gasPriceButtonGroupProps,
gasButtonGroupShown,
showGasButtonGroup
2018-04-11 16:21:54 +02:00
} = this.props
return (
2018-06-29 19:19:40 +02:00
<SendRowWrapper
label={`${this.context.t('transactionFee')}:`}
2018-06-29 19:19:40 +02:00
showError={gasFeeError}
errorType={'gasFee'}
>
{gasButtonGroupShown
? <div>
<GasPriceButtonGroup
className="gas-price-button-group--small"
showCheck={false}
{...this.props.gasPriceButtonGroupProps}
/>
<div className="advanced-gas-options-btn" onClick={() => showCustomizeGasModal()}>
Advanced Options
</div>
</div>
: <GasFeeDisplay
conversionRate={conversionRate}
convertedCurrency={convertedCurrency}
gasLoadingError={gasLoadingError}
gasTotal={gasTotal}
showGasButtonGroup={showGasButtonGroup}
onClick={() => showCustomizeGasModal()}
/>}
2018-04-11 16:21:54 +02:00
</SendRowWrapper>
)
2018-04-11 16:21:54 +02:00
}
}