Skip to content

Commit 4227d07

Browse files
committed
Add menu icon to toggle TOC on small viewports
1 parent 614f527 commit 4227d07

File tree

4 files changed

+51
-6
lines changed

4 files changed

+51
-6
lines changed

bb.edn

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"site/index.html" "build/index.html"
1313
"site/style.css" "build/style.css"
1414
"docs/style.css" "build/docs/style.css"
15-
"docs/reset.css" "build/docs/reset.css"}]
15+
"docs/reset.css" "build/docs/reset.css"
16+
"docs/ui.js" "build/docs/ui.js"}]
1617
(fs/copy src dest {:replace-existing true}))}
1718
build
1819
{:depends [docstrings files]

docs/docinfo.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<link rel="preconnect" href="https://fonts.googleapis.com">
22
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
33
<link href="https://fonts.googleapis.com/css2?family=Barlow+Condensed:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Bebas+Neue&family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap" rel="stylesheet">
4-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.0.1/css/solid.min.css" integrity="sha512-EHa6vH03/Ty92WahM0/tet1Qicl76zihDCkBnFhN3kFGQkC+mc86d7V+6y2ypiLbk3h0beZAGdUpzfMcb06cMg==" crossorigin="anonymous" referrerpolicy="no-referrer">
4+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.0.1/css/all.min.css" integrity="sha512-2SwdPD6INVrV/lHTZbO2nodKhrnDdJK9/kg2XD1r9uGqPo1cUbujc+IYdlYdEErWNu69gVcYgdxlmVmzTWnetw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
55
<link href="style.css" rel="stylesheet">
6+
<script src="ui.js"></script>

docs/style.css

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ body {
6464
color: #93dd56;
6565
}
6666

67+
#header .menu-icon {
68+
display: none;
69+
}
70+
6771
#content {
6872
margin: 0 auto;
6973
max-width: 55rem;
@@ -114,9 +118,9 @@ body {
114118
}
115119

116120
#header {
117-
width: 100%;
121+
width: auto;
122+
right: 0;
118123
height: 44px;
119-
overflow: hidden;
120124
border-right: none;
121125
border-bottom: #404040 1px solid;
122126
}
@@ -127,12 +131,42 @@ body {
127131
font-size: 30px;
128132
margin: 0;
129133
padding-top: 2px;
134+
width: 100px;
130135
}
131136

132137
#header h1 a {
133138
padding-left: 44px;
134139
}
135140

141+
#header .menu-icon {
142+
font-family: FontAwesome;
143+
font-style: normal;
144+
font-weight: normal;
145+
font-size: 24px;
146+
color: white;
147+
display: block;
148+
float: right;
149+
margin: 5px 10px 0 0;
150+
}
151+
152+
#header .menu-icon:before {
153+
content: '\f0c9';
154+
}
155+
156+
#header.is-open {
157+
height: auto;
158+
}
159+
160+
#header.is-open #toc {
161+
display: block;
162+
height: 100%;
163+
overflow: scroll;
164+
}
165+
166+
#header.is-open .menu-icon:before {
167+
content: '\f00d';
168+
}
169+
136170
#content {
137171
margin-top: 44px;
138172
}
@@ -263,7 +297,6 @@ kbd {
263297
}
264298

265299
.concise-index {
266-
width: 36em;
267300
margin-bottom: 1rem;
268301
}
269302

@@ -276,7 +309,7 @@ kbd {
276309
}
277310

278311
.concise-index ul {
279-
columns: 2;
312+
column-width: 13rem;
280313
column-gap: 1rem;
281314
margin: 0;
282315
padding: 0;

docs/ui.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
document.addEventListener('DOMContentLoaded', () => {
2+
const header = document.querySelector('#header');
3+
const icon = document.createElement('i');
4+
icon.className = 'menu-icon';
5+
header.prepend(icon);
6+
7+
icon.addEventListener('click', () => {
8+
header.classList.toggle('is-open');
9+
});
10+
});

0 commit comments

Comments
 (0)