UNPKG

1.05 kBTypeScriptView Raw
1import * as React from 'react';
2import styled from 'styled-components';
3
4import { styledByMediaQuery } from '../utils/styles';
5import Colors from '../Colors';
6import Sizes from '../Sizes';
7
8interface IProps {
9 children: string|React.ReactNode;
10}
11
12const Tooltip = styled.div.attrs({
13 className: 'tooltip',
14})`
15 font-size: ${ Sizes.s2}px;
16 opacity: 0;
17 background-color: ${ Colors.white};
18 color: ${ Colors.codGray };
19 border-radius: 4px;
20 padding: 10px;
21 position: absolute;
22 z-index: 1;
23 top: 50%;
24 left: 100%;
25 transform: translateY(-50%);
26 transition: all 0.3s ease-in;
27 filter: drop-shadow(0 2px 2px rgb(146, 146, 146));
28 max-height: 80px;
29 width: 100%;
30 z-index: -1;
31 display: none;
32
33 ${styledByMediaQuery(`display: block;`)}
34
35 &:before {
36 content: '';
37 position: inherit;
38 left: -13px;
39 top: 16px;
40 border-top: 5px solid transparent;
41 border-right: 13px solid white;
42 border-bottom: 7px solid transparent;
43 }
44`;
45
46export default React.memo(({children}: IProps) => (
47 <Tooltip>{children}</Tooltip>
48));