-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathSidebar.js
93 lines (82 loc) · 1.92 KB
/
Sidebar.js
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import React from "react";
import styled from "react-emotion";
import theme from "../styles/theme";
const Container = styled.div`
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: ${theme.space.l};
z-index: 100000;
@media (min-width: ${theme.breakpoint.m}) {
position: static;
height: auto;
z-index: 0;
}
`;
const Body = styled.div`
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
padding: ${theme.space.l};
background: ${theme.color.background};
transform: translateY(100%);
transition: transform ease-in 0.3s;
will-change: transform;
input[type="checkbox"]:checked + & {
transform: translateY(0);
transition: transform ${theme.transition.easing} 0.4s;
overflow: auto;
}
@media (min-width: ${theme.breakpoint.m}) {
position: static;
max-width: 250px;
height: 100%;
transform: none;
background: rgba(0, 0, 0, 0.01);
}
@media (min-width: ${theme.breakpoint.l}) {
max-width: 350px;
}
`;
const Toggle = styled.label`
position: relative;
display: block;
width: 100%;
height: ${theme.space.l};
text-align: center;
line-height: ${theme.space.l};
color: ${theme.color.actionDark};
background: ${theme.color.background};
font-family: ${theme.font.small};
font-size: ${theme.fontSize.epsilon};
border: 0;
z-index: 100001;
box-shadow: 0 -1px 1px rgba(0, 0, 0, 0.05);
@media (min-width: ${theme.breakpoint.m}) {
display: none;
}
`;
const Checkbox = styled.input`
display: none;
`;
const Sidebar = ({ children }) => (
<Container>
<Toggle htmlFor="sidebar-toggle">
Table of contents
</Toggle>
<Checkbox type="checkbox" id="sidebar-toggle" />
<Body>
<script
async
type="text/javascript"
src="//cdn.carbonads.com/carbon.js?serve=CE7I5KQJ&placement=survivejscom"
id="_carbonads_js"
></script>
{children}
</Body>
</Container>
);
export default Sidebar;