Skip to content

Commit c40bbe5

Browse files
committed
docs: collapse menu on mobile
1 parent 7dc559a commit c40bbe5

2 files changed

Lines changed: 56 additions & 10 deletions

File tree

src/css/style.css

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,15 @@ main {
126126

127127
.sidebar {
128128
font-family: var(--sans-serif-font);
129-
padding: 40px;
129+
padding-top: 72px;
130+
padding-bottom: 40px;
131+
padding-left: 36px;
132+
padding-right: 0;
130133
width: 300px;
131-
transition: transform 0.25s ease-out;
134+
transition: transform 0.3s ease-out;
135+
overflow: auto;
136+
height: 100vh;
137+
position: fixed;
132138
}
133139

134140
.sidebar .sidebar-nav {
@@ -188,10 +194,8 @@ main {
188194
background: hsla(0, 0%, 53%, 0.1);
189195
}
190196

191-
body.sticky .sidebar,
192-
body.sticky .sidebar-toggle {
193-
cursor: pointer;
194-
position: fixed;
197+
.sidebar-toggle {
198+
display: none;
195199
}
196200

197201
.content {
@@ -248,16 +252,58 @@ body.sticky .sidebar-toggle {
248252
}
249253

250254
@media screen and (max-width: 768px) {
251-
.github-corner,
252255
.sidebar {
253256
position: fixed;
254257
}
255258

256-
.sidebar,
259+
.github-corner svg {
260+
height: 62px !important;
261+
width: 62px !important;
262+
}
263+
264+
.sidebar {
265+
left: -300px;
266+
}
267+
257268
.sidebar-toggle {
269+
cursor: pointer;
270+
display: inherit;
271+
border: 0;
272+
outline: none;
273+
padding: 0 10px;
274+
left: 6px;
275+
transition: opacity 0.3s;
276+
z-index: 4;
277+
position: fixed;
278+
top: 0;
279+
height: 62px;
280+
width: 100%;
281+
background: var(--bg-color);
282+
}
283+
284+
.sidebar-toggle span {
285+
background-color: rgb(62, 84, 255);
286+
display: block;
287+
margin-bottom: 5px;
288+
width: 24px;
289+
height: 3px;
290+
}
291+
292+
body.sidebar-toggle {
258293
display: none;
259294
}
260295

296+
body.close .sidebar,
297+
body.close .content {
298+
transform: translateX(280px);
299+
}
300+
301+
body.close .sidebar-toggle {
302+
background: var(--bg-color);
303+
transition: background-color 0.3s;
304+
width: 284px;
305+
}
306+
261307
main {
262308
height: auto;
263309
overflow-x: hidden;
@@ -268,7 +314,7 @@ body.sticky .sidebar-toggle {
268314
max-width: 100vw;
269315
position: static;
270316
padding-top: 20px;
271-
transition: transform 0.25s ease;
317+
transition: transform 0.3s ease;
272318
}
273319

274320
.github-corner:hover .octo-arm {

static/style.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)