Skip to content

Commit 04edd69

Browse files
authored
fix: sidebar improvements (#123)
1 parent c8683b6 commit 04edd69

File tree

3 files changed

+51
-24
lines changed

3 files changed

+51
-24
lines changed

assets/css/v2/style.css

Lines changed: 47 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
font-feature-settings: 'liga' on, 'calt' on;
55

66
/* fallback to slightly thinner font on browsers without variable 'wght' support */
7-
font-weight: 300;
7+
font-weight: 400;
88

99
/* base rem = 16px by default, left as percentage for screen readers */
1010
font-size: 100%;
@@ -20,10 +20,10 @@
2020
--color-footer-text: #E2E2E2;
2121
--color-product-title: #8D8D8D;
2222

23-
--sidebar-margin: 3rem;
24-
--sidebar-line-box-side-length: 0.5rem;
25-
--sidebar-line-box-top: 0.375rem;
26-
--sidebar-line-box-left: 0.75rem;
23+
--sidebar-margin: 48px;
24+
--sidebar-line-box-side-length: 8px;
25+
--sidebar-line-box-top: 6px;
26+
--sidebar-line-box-left: 12px;
2727
--sidebar-width: 24rem;
2828
--side-gutter-width: 20rem;
2929
--text-content-width-iphone-13: 30rem;
@@ -76,13 +76,14 @@ header {
7676
.dropdown-content {
7777
position: absolute;
7878
background-color: white;
79-
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
79+
border: black 1px solid;
80+
box-shadow: 3px 3px 0px var(--color-shadow);
8081
z-index: 1;
8182
right: 0;
8283
display: none;
8384
width: 400px;
8485
max-width: 80vw;
85-
margin-right: 8px;
86+
margin-right: 2.5rem;
8687
}
8788

8889
.dropdown-content ul {
@@ -97,6 +98,11 @@ header {
9798
text-decoration: none;
9899
cursor: pointer;
99100
}
101+
102+
.remove-bottom-radius {
103+
border-bottom-left-radius: 0;
104+
border-bottom-right-radius: 0;
105+
}
100106
}
101107

102108
/* footer */
@@ -353,7 +359,6 @@ nav {
353359
background-color: var(--color-brand);
354360
color: var(--color-brand-100);
355361
border: none;
356-
font-weight: 500;
357362
font-size: 1.25rem;
358363
width: 100%;
359364
padding: 0.5rem;
@@ -371,7 +376,7 @@ nav {
371376
top: 0;
372377
min-width: 80%;
373378
margin-left: 46rem;
374-
padding: 0.75rem;
379+
padding: 1rem 1.5rem;
375380
background-color: white;
376381
border: black 1px solid;
377382
box-shadow: 3px 3px 0px var(--color-shadow);
@@ -397,7 +402,6 @@ nav {
397402

398403
.sidebar .sidebar-navigation {
399404
width: 100%;
400-
font-weight: 500;
401405
margin-left: var(--sidebar-margin);
402406
}
403407

@@ -410,11 +414,11 @@ nav {
410414
}
411415

412416
.sidebar ul :not(.sidebar-navigation) ul {
413-
padding-left: 1rem;
417+
padding-left: 16px;
414418
}
415419

416420
.sidebar .sidebar-navigation li {
417-
margin-bottom: 1rem;
421+
margin-bottom: 16px;
418422
}
419423

420424
.sidebar .sidebar-navigation a {
@@ -452,38 +456,56 @@ nav {
452456
content: '';
453457
position: absolute;
454458
border-left: black 1px solid;
455-
left: -0.525rem;
456-
top: -1.33rem;
457-
height: calc(100% + 0.78rem);
459+
left: -8.5px;
460+
top: -21.5px;
461+
height: calc(100% + 12.5px);
458462
}
459463

460464
/* Every other Sidebar Partial Horizontal Lines */
461465
.toggle-checkbox:checked ~ .collapsible-content li {
462466
position: relative;
463467
}
464468

465-
.toggle-checkbox:checked ~ .collapsible-content li::after {
469+
.collapsible-content .box::after {
466470
content: '';
467471
position: absolute;
468472
border-top: black 1px solid;
469-
left: -1.5rem;
470-
width: 0.75rem;
471-
top: 0.6rem;
473+
left: -11.5px;
474+
width: 11.5px;
475+
top: 50%;
476+
}
477+
478+
.collapsible-content .opened::after {
479+
content: '';
480+
position: absolute;
481+
border-top: black 1px solid;
482+
left: -12.5px;
483+
width: 11.5px;
484+
top: 50%;
485+
}
486+
487+
.collapsible-content .box-link::after {
488+
content: '';
489+
position: absolute;
490+
border-top: black 1px solid;
491+
left: -11.5px;
492+
width: 11.5px;
493+
top: 50%;
472494
}
473495

474496
.selected {
475497
font-weight: 800;
476498
}
477499

478500
.sidebar .sidebar-navigation li:first-child {
479-
margin-top: 1rem;
501+
margin-top: 16px;
480502
}
481503

482504
.sidebar .sidebar-navigation ul li .box-link {
483505
content: '';
484506
background-color: black;
485507
position: absolute;
486-
width: 0.1rem;
508+
width: 1px;
487509
height: var(--sidebar-line-box-side-length);
488510
margin-top: var(--sidebar-line-box-top);
489511
left: var(--sidebar-line-box-left);
@@ -512,11 +534,13 @@ nav {
512534
}
513535

514536
.sidebar .sidebar-navigation ul li .partial-box {
515-
margin-left: -1.5rem;
537+
margin-left: -24px;
516538
}
517539

518540
.sidebar .sidebar-navigation ul li .partial {
519-
left: -0.8125rem;
541+
margin-top: 0;
542+
top: calc(50% - 3.5px);
543+
left: -13px;
520544
}
521545

522546
/* First Sidebar Nav Vertical Line */

assets/js/product-selector.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@ document.addEventListener("DOMContentLoaded", function() {
99
productSelectorButton.addEventListener("click", function() {
1010
if (productSelectorContent.style.display === "block") {
1111
productSelectorContent.style.display = "none";
12+
productSelectorButton.classList.remove("remove-bottom-radius");
1213
} else {
1314
productSelectorContent.style.display = "block";
15+
productSelectorButton.classList.add("remove-bottom-radius");
1416
}
1517
});
1618

1719
window.addEventListener("click", function(event) {
1820
if (!event.target.matches('#product-selector-button') && !event.target.matches('#product-selector-button-icon')) {
1921
productSelectorContent.style.display = "none";
2022
}
23+
productSelectorButton.classList.remove("remove-bottom-radius");
2124
});
2225
});

layouts/partials/sidebar-v2.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
{{ else }}
7373
<span class="box-link"></span>
7474
{{ end }}
75-
<a href="{{ .Permalink }}">{{ .Title }} </a>
75+
<a href="{{ .Permalink }}" style="{{if eq $.Permalink .Permalink}}font-weight: bold;{{end}}">{{ .Title }} </a>
7676
{{ end }}
7777
</li>
7878
{{ end }}

0 commit comments

Comments
 (0)