Skip to content

Commit f61d398

Browse files
authored
Merge pull request #333 from codex-team/ui/sidebar-top-level-typography
Sidebar: bold top-level items only; tighter spacing after collapsed sections
2 parents 5a92c72 + bf141c7 commit f61d398

3 files changed

Lines changed: 23 additions & 22 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "codex.docs",
33
"license": "Apache-2.0",
4-
"version": "2.3.1",
4+
"version": "2.3.2",
55
"type": "module",
66
"bin": {
77
"codex.docs": "dist/backend/app.js"

src/backend/views/components/sidebar-section.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{% set is_leaf = node.children is not defined or node.children is empty %}
2-
<section class="docs-sidebar__section{{ nested ? ' docs-sidebar__section--nested' : '' }}{{ is_leaf ? ' docs-sidebar__section--leaf' : '' }}" data-id="{{ node._id }}">
2+
<section class="docs-sidebar__section{{ nested ? ' docs-sidebar__section--nested' : ' docs-sidebar__section--root' }}{{ is_leaf ? ' docs-sidebar__section--leaf' : '' }}" data-id="{{ node._id }}">
33
<a class="docs-sidebar__section-title-wrapper"
44
href="{{ node.uri ? '/' ~ node.uri : '/page/' ~ node._id }}"
55
>
6-
<div class="docs-sidebar__section-title {{ page is defined and toString(page._id) == toString(node._id) ? 'docs-sidebar__section-title--active' : '' }}">
6+
<div class="docs-sidebar__section-title{% if not nested %} docs-sidebar__section-title--root{% endif %}{% if page is defined and toString(page._id) == toString(node._id) %} docs-sidebar__section-title--active{% endif %}">
77
<span>
88
{{ node.title | striptags }}
99
</span>

src/frontend/styles/components/sidebar.pcss

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -123,23 +123,6 @@
123123
margin-top: 2px;
124124
}
125125

126-
&--leaf {
127-
.docs-sidebar__section-title {
128-
font-size: 14px;
129-
line-height: 21px;
130-
height: 29px;
131-
132-
@media (--mobile) {
133-
font-size: 16px;
134-
line-height: 21px;
135-
}
136-
}
137-
138-
.docs-sidebar__section-title--active {
139-
color: white;
140-
}
141-
}
142-
143126
&--hidden {
144127
display: none;
145128
}
@@ -202,12 +185,30 @@
202185
/* plain radius: --squircle uses mask-box-image and gets clipped by overflow:hidden on ancestors */
203186
border-radius: 8px;
204187
}
188+
}
205189

206-
&:has(.docs-sidebar__section-toggler) {
207-
font-weight: 700;
190+
/* 1st-level title row (see sidebar-section.twig: --root). */
191+
&__section-title--root {
192+
font-weight: 700;
193+
}
194+
195+
/* Deeper levels: one style for all nested items. */
196+
&__section--nested &__section-title {
197+
font-size: 14px;
198+
line-height: 21px;
199+
height: 29px;
200+
font-weight: 400;
201+
202+
@media (--mobile) {
203+
font-size: 16px;
204+
line-height: 21px;
208205
}
209206
}
210207

208+
.docs-sidebar__section--root.docs-sidebar__section--collapsed + .docs-sidebar__section--root {
209+
margin-top: 12px;
210+
}
211+
211212
&__section-title > span {
212213
white-space: nowrap;
213214
overflow: hidden;

0 commit comments

Comments
 (0)