mirror of https://github.com/trezor/trezor-wallet
Merge branch 'styled-components-refactor' of https://github.com/satoshilabs/trezor-wallet into styled-components-refactor
commit
08659f70f4
@ -0,0 +1,179 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import RcTooltip from 'rc-tooltip';
|
||||||
|
import colors from 'config/colors';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
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 StyledRcTooltip = styled(RcTooltip)`
|
||||||
|
.rc-tooltip {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 1070;
|
||||||
|
display: block;
|
||||||
|
visibility: visible;
|
||||||
|
border: 1px solid ${colors.DIVIDER};
|
||||||
|
border-radius: 3px;
|
||||||
|
box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rc-tooltip-hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rc-tooltip-inner {
|
||||||
|
padding: 8px 10px;
|
||||||
|
color: ${colors.TEXT_SECONDARY};
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.5;
|
||||||
|
text-align: left;
|
||||||
|
text-decoration: none;
|
||||||
|
background-color: ${colors.WHITE};
|
||||||
|
border-radius: 3px;
|
||||||
|
min-height: 34px;
|
||||||
|
border: 1px solid ${colors.WHITE};
|
||||||
|
}
|
||||||
|
.rc-tooltip-arrow,
|
||||||
|
.rc-tooltip-arrow-inner {
|
||||||
|
position: absolute;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
border-color: transparent;
|
||||||
|
border-style: solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rc-tooltip-placement-top .rc-tooltip-arrow,
|
||||||
|
.rc-tooltip-placement-topLeft .rc-tooltip-arrow,
|
||||||
|
.rc-tooltip-placement-topRight .rc-tooltip-arrow {
|
||||||
|
bottom: -6px;
|
||||||
|
margin-left: -6px;
|
||||||
|
border-width: 6px 6px 0;
|
||||||
|
border-top-color: ${colors.DIVIDER};
|
||||||
|
}
|
||||||
|
.rc-tooltip-placement-top .rc-tooltip-arrow-inner,
|
||||||
|
.rc-tooltip-placement-topLeft .rc-tooltip-arrow-inner,
|
||||||
|
.rc-tooltip-placement-topRight .rc-tooltip-arrow-inner {
|
||||||
|
bottom: 2px;
|
||||||
|
margin-left: -6px;
|
||||||
|
border-width: 6px 6px 0;
|
||||||
|
border-top-color: ${colors.WHITE};
|
||||||
|
}
|
||||||
|
.rc-tooltip-placement-top .rc-tooltip-arrow {
|
||||||
|
left: 50%;
|
||||||
|
}
|
||||||
|
.rc-tooltip-placement-topLeft .rc-tooltip-arrow {
|
||||||
|
left: 15%;
|
||||||
|
}
|
||||||
|
.rc-tooltip-placement-topRight .rc-tooltip-arrow {
|
||||||
|
right: 15%;
|
||||||
|
}
|
||||||
|
.rc-tooltip-placement-right .rc-tooltip-arrow,
|
||||||
|
.rc-tooltip-placement-rightTop .rc-tooltip-arrow,
|
||||||
|
.rc-tooltip-placement-rightBottom .rc-tooltip-arrow {
|
||||||
|
left: -5px;
|
||||||
|
margin-top: -6px;
|
||||||
|
border-width: 6px 6px 6px 0;
|
||||||
|
border-right-color: ${colors.DIVIDER};
|
||||||
|
}
|
||||||
|
.rc-tooltip-placement-right .rc-tooltip-arrow-inner,
|
||||||
|
.rc-tooltip-placement-rightTop .rc-tooltip-arrow-inner,
|
||||||
|
.rc-tooltip-placement-rightBottom .rc-tooltip-arrow-inner {
|
||||||
|
left: 1px;
|
||||||
|
margin-top: -6px;
|
||||||
|
border-width: 6px 6px 6px 0;
|
||||||
|
border-right-color: ${colors.WHITE};
|
||||||
|
}
|
||||||
|
.rc-tooltip-placement-right .rc-tooltip-arrow {
|
||||||
|
top: 50%;
|
||||||
|
}
|
||||||
|
.rc-tooltip-placement-rightTop .rc-tooltip-arrow {
|
||||||
|
top: 15%;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
.rc-tooltip-placement-rightBottom .rc-tooltip-arrow {
|
||||||
|
bottom: 15%;
|
||||||
|
}
|
||||||
|
.rc-tooltip-placement-left .rc-tooltip-arrow,
|
||||||
|
.rc-tooltip-placement-leftTop .rc-tooltip-arrow,
|
||||||
|
.rc-tooltip-placement-leftBottom .rc-tooltip-arrow {
|
||||||
|
right: -5px;
|
||||||
|
margin-top: -6px;
|
||||||
|
border-width: 6px 0 6px 6px;
|
||||||
|
border-left-color: ${colors.DIVIDER};
|
||||||
|
}
|
||||||
|
.rc-tooltip-placement-left .rc-tooltip-arrow-inner,
|
||||||
|
.rc-tooltip-placement-leftTop .rc-tooltip-arrow-inner,
|
||||||
|
.rc-tooltip-placement-leftBottom .rc-tooltip-arrow-inner {
|
||||||
|
right: 1px;
|
||||||
|
margin-top: -6px;
|
||||||
|
border-width: 6px 0 6px 6px;
|
||||||
|
border-left-color: ${colors.WHITE};
|
||||||
|
}
|
||||||
|
.rc-tooltip-placement-left .rc-tooltip-arrow {
|
||||||
|
top: 50%;
|
||||||
|
}
|
||||||
|
.rc-tooltip-placement-leftTop .rc-tooltip-arrow {
|
||||||
|
top: 15%;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
.rc-tooltip-placement-leftBottom .rc-tooltip-arrow {
|
||||||
|
bottom: 15%;
|
||||||
|
}
|
||||||
|
.rc-tooltip-placement-bottom .rc-tooltip-arrow,
|
||||||
|
.rc-tooltip-placement-bottomLeft .rc-tooltip-arrow,
|
||||||
|
.rc-tooltip-placement-bottomRight .rc-tooltip-arrow {
|
||||||
|
top: -5px;
|
||||||
|
margin-left: -6px;
|
||||||
|
border-width: 0 6px 6px;
|
||||||
|
border-bottom-color: ${colors.DIVIDER};
|
||||||
|
}
|
||||||
|
.rc-tooltip-placement-bottom .rc-tooltip-arrow-inner,
|
||||||
|
.rc-tooltip-placement-bottomLeft .rc-tooltip-arrow-inner,
|
||||||
|
.rc-tooltip-placement-bottomRight .rc-tooltip-arrow-inner {
|
||||||
|
top: 1px;
|
||||||
|
margin-left: -6px;
|
||||||
|
border-width: 0 6px 6px;
|
||||||
|
border-bottom-color: ${colors.WHITE};
|
||||||
|
}
|
||||||
|
.rc-tooltip-placement-bottom .rc-tooltip-arrow {
|
||||||
|
left: 50%;
|
||||||
|
}
|
||||||
|
.rc-tooltip-placement-bottomLeft .rc-tooltip-arrow {
|
||||||
|
left: 15%;
|
||||||
|
}
|
||||||
|
.rc-tooltip-placement-bottomRight .rc-tooltip-arrow {
|
||||||
|
right: 15%;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const Tooltip = ({
|
||||||
|
content, placement = 'bottomRight', children, className,
|
||||||
|
}) => (
|
||||||
|
<StyledRcTooltip
|
||||||
|
className={className}
|
||||||
|
arrowContent={<div className="rc-tooltip-arrow-inner" />}
|
||||||
|
placement={placement}
|
||||||
|
overlay={<TooltipContent>{content}</TooltipContent>}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</StyledRcTooltip>
|
||||||
|
);
|
||||||
|
|
||||||
|
Tooltip.propTypes = {
|
||||||
|
placement: PropTypes.string,
|
||||||
|
className: PropTypes.string,
|
||||||
|
children: PropTypes.oneOfType([
|
||||||
|
PropTypes.element,
|
||||||
|
PropTypes.string,
|
||||||
|
]),
|
||||||
|
content: PropTypes.oneOfType([
|
||||||
|
PropTypes.element,
|
||||||
|
PropTypes.string,
|
||||||
|
]),
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Tooltip;
|
@ -1,26 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import styled from 'styled-components';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import { FONT_SIZE } from 'config/variables';
|
|
||||||
|
|
||||||
const Wrapper = styled.div`
|
|
||||||
width: ${props => (props.isAside ? '260px' : '320px')};
|
|
||||||
font-size: ${FONT_SIZE.SMALLEST};
|
|
||||||
`;
|
|
||||||
|
|
||||||
const TooltipContent = ({
|
|
||||||
children, isAside = false,
|
|
||||||
}) => (
|
|
||||||
<Wrapper
|
|
||||||
isAside={isAside}
|
|
||||||
>
|
|
||||||
{children}
|
|
||||||
</Wrapper>
|
|
||||||
);
|
|
||||||
|
|
||||||
TooltipContent.propTypes = {
|
|
||||||
children: PropTypes.node,
|
|
||||||
isAside: PropTypes.bool,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default TooltipContent;
|
|
@ -1,28 +0,0 @@
|
|||||||
@color_white: #ffffff;
|
|
||||||
|
|
||||||
@color_header: #212121;
|
|
||||||
@color_body: #E3E3E3;
|
|
||||||
@color_main: #FBFBFB;
|
|
||||||
@color_landing: #F9F9F9;
|
|
||||||
|
|
||||||
@color_text_primary: #494949;
|
|
||||||
@color_text_secondary: #757575;
|
|
||||||
|
|
||||||
@color_gray_light: #F2F2F2; // hover menu
|
|
||||||
@color_divider: #E3E3E3; //#EBEBEB;
|
|
||||||
|
|
||||||
@color_green_primary: #01B757;
|
|
||||||
@color_green_secondary: #00AB51;
|
|
||||||
@color_green_tertiary: #009546;
|
|
||||||
|
|
||||||
@color_info_primary: #1E7FF0;
|
|
||||||
@color_info_secondary: #E1EFFF;
|
|
||||||
|
|
||||||
@color_warning_primary: #EB8A00;
|
|
||||||
@color_warning_secondary: #FFEFD9;
|
|
||||||
|
|
||||||
@color_success_primary: #01B757;
|
|
||||||
@color_success_secondary: #DFFFEE;
|
|
||||||
|
|
||||||
@color_error_primary: #ED1212;
|
|
||||||
@color_error_secondary: #FFE9E9;
|
|
@ -1,2 +0,0 @@
|
|||||||
@import './colors.less';
|
|
||||||
@import './rcTooltip.less';
|
|
@ -1,152 +0,0 @@
|
|||||||
.tooltip-wrapper {
|
|
||||||
width: 320px;
|
|
||||||
font-size: 10px;
|
|
||||||
span {
|
|
||||||
color: @color_green_primary;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.aside-tooltip-wrapper {
|
|
||||||
width: 260px;
|
|
||||||
font-size: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rc-tooltip {
|
|
||||||
position: absolute;
|
|
||||||
z-index: 1070;
|
|
||||||
display: block;
|
|
||||||
visibility: visible;
|
|
||||||
border: 1px solid @color_divider;
|
|
||||||
border-radius: 3px;
|
|
||||||
box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
|
|
||||||
}
|
|
||||||
|
|
||||||
.rc-tooltip-hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rc-tooltip-inner {
|
|
||||||
padding: 8px 10px;
|
|
||||||
color: @color_text_secondary;
|
|
||||||
font-size: 12px;
|
|
||||||
line-height: 1.5;
|
|
||||||
text-align: left;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: @color_white;
|
|
||||||
border-radius: 3px;
|
|
||||||
min-height: 34px;
|
|
||||||
border: 1px solid @color_white;
|
|
||||||
}
|
|
||||||
.rc-tooltip-arrow,
|
|
||||||
.rc-tooltip-arrow-inner {
|
|
||||||
position: absolute;
|
|
||||||
width: 0;
|
|
||||||
height: 0;
|
|
||||||
border-color: transparent;
|
|
||||||
border-style: solid;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.rc-tooltip-placement-top .rc-tooltip-arrow,
|
|
||||||
.rc-tooltip-placement-topLeft .rc-tooltip-arrow,
|
|
||||||
.rc-tooltip-placement-topRight .rc-tooltip-arrow {
|
|
||||||
bottom: -6px;
|
|
||||||
margin-left: -6px;
|
|
||||||
border-width: 6px 6px 0;
|
|
||||||
border-top-color: @color_divider;
|
|
||||||
}
|
|
||||||
.rc-tooltip-placement-top .rc-tooltip-arrow-inner,
|
|
||||||
.rc-tooltip-placement-topLeft .rc-tooltip-arrow-inner,
|
|
||||||
.rc-tooltip-placement-topRight .rc-tooltip-arrow-inner {
|
|
||||||
//bottom: 1px;
|
|
||||||
bottom: 2px;
|
|
||||||
margin-left: -6px;
|
|
||||||
border-width: 6px 6px 0;
|
|
||||||
border-top-color: @color_white;
|
|
||||||
}
|
|
||||||
.rc-tooltip-placement-top .rc-tooltip-arrow {
|
|
||||||
left: 50%;
|
|
||||||
}
|
|
||||||
.rc-tooltip-placement-topLeft .rc-tooltip-arrow {
|
|
||||||
left: 15%;
|
|
||||||
}
|
|
||||||
.rc-tooltip-placement-topRight .rc-tooltip-arrow {
|
|
||||||
right: 15%;
|
|
||||||
}
|
|
||||||
.rc-tooltip-placement-right .rc-tooltip-arrow,
|
|
||||||
.rc-tooltip-placement-rightTop .rc-tooltip-arrow,
|
|
||||||
.rc-tooltip-placement-rightBottom .rc-tooltip-arrow {
|
|
||||||
left: -5px;
|
|
||||||
margin-top: -6px;
|
|
||||||
border-width: 6px 6px 6px 0;
|
|
||||||
border-right-color: @color_divider;
|
|
||||||
}
|
|
||||||
.rc-tooltip-placement-right .rc-tooltip-arrow-inner,
|
|
||||||
.rc-tooltip-placement-rightTop .rc-tooltip-arrow-inner,
|
|
||||||
.rc-tooltip-placement-rightBottom .rc-tooltip-arrow-inner {
|
|
||||||
left: 1px;
|
|
||||||
margin-top: -6px;
|
|
||||||
border-width: 6px 6px 6px 0;
|
|
||||||
border-right-color: @color_white;
|
|
||||||
}
|
|
||||||
.rc-tooltip-placement-right .rc-tooltip-arrow {
|
|
||||||
top: 50%;
|
|
||||||
}
|
|
||||||
.rc-tooltip-placement-rightTop .rc-tooltip-arrow {
|
|
||||||
top: 15%;
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
.rc-tooltip-placement-rightBottom .rc-tooltip-arrow {
|
|
||||||
bottom: 15%;
|
|
||||||
}
|
|
||||||
.rc-tooltip-placement-left .rc-tooltip-arrow,
|
|
||||||
.rc-tooltip-placement-leftTop .rc-tooltip-arrow,
|
|
||||||
.rc-tooltip-placement-leftBottom .rc-tooltip-arrow {
|
|
||||||
right: -5px;
|
|
||||||
margin-top: -6px;
|
|
||||||
border-width: 6px 0 6px 6px;
|
|
||||||
border-left-color: @color_divider;
|
|
||||||
}
|
|
||||||
.rc-tooltip-placement-left .rc-tooltip-arrow-inner,
|
|
||||||
.rc-tooltip-placement-leftTop .rc-tooltip-arrow-inner,
|
|
||||||
.rc-tooltip-placement-leftBottom .rc-tooltip-arrow-inner {
|
|
||||||
right: 1px;
|
|
||||||
margin-top: -6px;
|
|
||||||
border-width: 6px 0 6px 6px;
|
|
||||||
border-left-color: @color_white;
|
|
||||||
}
|
|
||||||
.rc-tooltip-placement-left .rc-tooltip-arrow {
|
|
||||||
top: 50%;
|
|
||||||
}
|
|
||||||
.rc-tooltip-placement-leftTop .rc-tooltip-arrow {
|
|
||||||
top: 15%;
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
.rc-tooltip-placement-leftBottom .rc-tooltip-arrow {
|
|
||||||
bottom: 15%;
|
|
||||||
}
|
|
||||||
.rc-tooltip-placement-bottom .rc-tooltip-arrow,
|
|
||||||
.rc-tooltip-placement-bottomLeft .rc-tooltip-arrow,
|
|
||||||
.rc-tooltip-placement-bottomRight .rc-tooltip-arrow {
|
|
||||||
top: -5px;
|
|
||||||
margin-left: -6px;
|
|
||||||
border-width: 0 6px 6px;
|
|
||||||
border-bottom-color: @color_divider;
|
|
||||||
}
|
|
||||||
.rc-tooltip-placement-bottom .rc-tooltip-arrow-inner,
|
|
||||||
.rc-tooltip-placement-bottomLeft .rc-tooltip-arrow-inner,
|
|
||||||
.rc-tooltip-placement-bottomRight .rc-tooltip-arrow-inner {
|
|
||||||
top: 1px;
|
|
||||||
margin-left: -6px;
|
|
||||||
border-width: 0 6px 6px;
|
|
||||||
border-bottom-color: @color_white;
|
|
||||||
}
|
|
||||||
.rc-tooltip-placement-bottom .rc-tooltip-arrow {
|
|
||||||
left: 50%;
|
|
||||||
}
|
|
||||||
.rc-tooltip-placement-bottomLeft .rc-tooltip-arrow {
|
|
||||||
left: 15%;
|
|
||||||
}
|
|
||||||
.rc-tooltip-placement-bottomRight .rc-tooltip-arrow {
|
|
||||||
right: 15%;
|
|
||||||
}
|
|
Loading…
Reference in new issue