1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-28 03:08:30 +00:00

Added read more support, gas price tooltip

This commit is contained in:
Vladimir Volek 2018-09-27 13:03:50 +02:00
parent 9e2b5ddb1e
commit 0130a84a2a
2 changed files with 31 additions and 5 deletions

View File

@ -1,6 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import RcTooltip from 'rc-tooltip'; import RcTooltip from 'rc-tooltip';
import colors from 'config/colors'; import colors from 'config/colors';
import Link from 'components/Link';
import styled from 'styled-components'; import styled from 'styled-components';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
@ -165,6 +166,19 @@ const Wrapper = styled.div`
} }
`; `;
const Content = styled.div`
padding-bottom: 10px;
`;
const ContentWrapper = styled.div``;
const ReadMore = styled.div`
padding: 10px 0;
text-align: center;
width: 100%;
color: ${colors.WHITE};
border-top: 1px solid ${colors.TEXT_SECONDARY};
`;
class Tooltip extends Component { class Tooltip extends Component {
render() { render() {
const { const {
@ -172,6 +186,7 @@ class Tooltip extends Component {
placement, placement,
content, content,
children, children,
readMoreLink,
maxWidth, maxWidth,
} = this.props; } = this.props;
return ( return (
@ -184,7 +199,16 @@ class Tooltip extends Component {
getTooltipContainer={() => this.tooltipContainerRef} getTooltipContainer={() => this.tooltipContainerRef}
arrowContent={<div className="rc-tooltip-arrow-inner" />} arrowContent={<div className="rc-tooltip-arrow-inner" />}
placement={placement} placement={placement}
overlay={content} overlay={() => (
<ContentWrapper>
<Content>{content}</Content>
{readMoreLink && (
<Link target="_blank" href={readMoreLink}>
<ReadMore>Read more</ReadMore>
</Link>
)
}
</ContentWrapper>)}
> >
{children} {children}
</RcTooltip> </RcTooltip>
@ -205,6 +229,7 @@ Tooltip.propTypes = {
PropTypes.element, PropTypes.element,
PropTypes.string, PropTypes.string,
]), ]),
readMoreLink: PropTypes.string,
}; };
export default Tooltip; export default Tooltip;

View File

@ -190,12 +190,13 @@ const AdvancedForm = (props: Props) => {
<Tooltip <Tooltip
content={( content={(
<React.Fragment> <React.Fragment>
Gas Price is the amount you pay per unit of gas.<br /> Gas price refers to the amount of ether you are willing to pay for every
<GreenSpan>TX fee = gas price * gas limit</GreenSpan> &amp; is paid to miners for including your TX in a block.<br /> unit of gas, and is usually measured in Gwei. <GreenSpan>Transaction fee = gas limit * gas price</GreenSpan> Increasing the gas price will get the transaction confirmed sooner but
Higher the gas price = faster transaction, but more expensive. Recommended is <GreenSpan>{recommendedGasPrice} GWEI.</GreenSpan><br /> makes it more expensive. The recommended gas price is <GreenSpan>{recommendedGasPrice} GWEI</GreenSpan>.
<Link href="https://myetherwallet.github.io/knowledge-base/gas/what-is-gas-ethereum.html" target="_blank" rel="noreferrer noopener" isGreen>Read more</Link>
</React.Fragment> </React.Fragment>
)} )}
maxWidth={400}
readMoreLink="https://wiki.trezor.io/Ethereum_Wallet#Gas_price_.28GWEI.29"
placement="top" placement="top"
> >
<Icon <Icon