1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-24 09:18:09 +00:00

Fixed tooltip

This commit is contained in:
Vladimir Volek 2018-09-20 16:00:14 +02:00
parent 9bbed8d6f2
commit 2678cf3a95
2 changed files with 11 additions and 8 deletions

View File

@ -3,15 +3,10 @@ import RcTooltip from 'rc-tooltip';
import colors from 'config/colors'; import colors from 'config/colors';
import styled from 'styled-components'; import styled from 'styled-components';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { FONT_SIZE } from 'config/variables';
const TooltipContent = styled.div`
width: ${props => (props.isAside ? '260px' : '320px')};
font-size: ${FONT_SIZE.SMALLEST};
`;
const Wrapper = styled.div` const Wrapper = styled.div`
.rc-tooltip { .rc-tooltip {
max-width: ${props => `${props.maxWidth}px` || 'auto'};
position: absolute; position: absolute;
z-index: 1070; z-index: 1070;
display: block; display: block;
@ -177,9 +172,11 @@ class Tooltip extends Component {
placement, placement,
content, content,
children, children,
maxWidth,
} = this.props; } = this.props;
return ( return (
<Wrapper <Wrapper
maxWidth={maxWidth}
className={className} className={className}
innerRef={(node) => { this.tooltipContainerRef = node; }} innerRef={(node) => { this.tooltipContainerRef = node; }}
> >
@ -187,7 +184,7 @@ 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={<TooltipContent>{content}</TooltipContent>} overlay={content}
> >
{children} {children}
</RcTooltip> </RcTooltip>
@ -203,6 +200,7 @@ Tooltip.propTypes = {
PropTypes.element, PropTypes.element,
PropTypes.string, PropTypes.string,
]), ]),
maxWidth: PropTypes.number,
content: PropTypes.oneOfType([ content: PropTypes.oneOfType([
PropTypes.element, PropTypes.element,
PropTypes.string, PropTypes.string,

View File

@ -27,6 +27,10 @@ const Text = styled.span`
color: ${colors.TEXT_SECONDARY}; color: ${colors.TEXT_SECONDARY};
`; `;
const TooltipContent = styled.div`
font-size: ${FONT_SIZE.SMALLEST};
`;
const RowAccountWrapper = styled.div` const RowAccountWrapper = styled.div`
width: 100%; width: 100%;
display: flex; display: flex;
@ -183,7 +187,8 @@ const AccountMenu = (props: Props): ?React$Element<string> => {
} else { } else {
discoveryStatus = ( discoveryStatus = (
<Tooltip <Tooltip
content={<React.Fragment>To add a new account, last account must have some transactions.</React.Fragment>} maxWidth={300}
content={<TooltipContent>To add a new account, last account must have some transactions.</TooltipContent>}
placement="bottom" placement="bottom"
> >
<Row> <Row>