forked from woowacourse/a11y-airline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tooltip.tsx
42 lines (37 loc) · 923 Bytes
/
Tooltip.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import styled from 'styled-components';
const Tooltip = () => {
return (
<>
<S.Question aria-label='tooltip'>?</S.Question>
<S.StyledTooltip aria-live='assertive' id='tooltip' role='tooltip'>
국민은행 61210204071715로 후원해 결식아동을 도와보세요!
</S.StyledTooltip>
</>
);
};
const S = {
Question: styled.button`
width: 20px;
height: 20px;
border: 1px solid #cbcbcb;
color: #cbcbcb;
border-radius: 50%;
text-align: center;
cursor: help;
background-color: white;
&:hover + [role='tooltip'],
&:focus + [role='tooltip'] {
display: block !important;
background-color: red;
}
`,
StyledTooltip: styled.div`
display: ${(props) => (props.role === 'tooltip' ? 'none' : 'block')};
position: absolute;
top: -3rem;
left: 4rem;
padding: 4px;
color: white;
`,
};
export default Tooltip;