-
Notifications
You must be signed in to change notification settings - Fork 0
/
Burger.tsx
60 lines (59 loc) · 1.46 KB
/
Burger.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
type Props = {
active: boolean;
onClick: () => void;
};
export default function Burger({ active, onClick }: Props) {
return (
<div className={"container " + (active ? "active" : "")} onClick={onClick}>
<div className={"meat meat-1"} />
<div className={"meat meat-2"} />
<div className={"meat meat-3"} />
<style jsx>
{`
.container {
position: fixed;
width: 38px;
height: 38px;
cursor: pointer;
top: 1rem;
left: 1.25rem;
z-index: 2;
background-color: rgba(255, 255, 255, 0.7);
}
.meat {
position: absolute;
width: 28px;
height: 2px;
background: #222;
top: calc(50% - 2px / 2);
left: calc(50% - 28px / 2);
transition: all 150ms ease-in;
}
.meat-1 {
transform: translateY(-10px);
}
.meat-2 {
width: calc(28px - 6px);
}
.meat-3 {
transform: translateY(10px);
}
.active .meat-1 {
transform: rotate(45deg);
}
.active .meat-2 {
opacity: 0;
}
.active .meat-3 {
transform: rotate(-45deg);
}
@media (min-width: 769px) {
.container {
display: none;
}
}
`}
</style>
</div>
);
}