Skip to content

Commit 2590dc3

Browse files
committed
Sidebar: Chevron styling
Fix chevron sizing Move chevron to right of links Fix nested li top padding Steal 1rem from left main
1 parent 55813dd commit 2590dc3

File tree

3 files changed

+126
-111
lines changed

3 files changed

+126
-111
lines changed

assets/css/v2/style.css

Lines changed: 123 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,12 @@ header {
281281
}
282282
}
283283

284+
main {
285+
flex: 1;
286+
min-width: 20rem;
287+
margin: 0 2rem 2rem 1rem;
288+
}
289+
284290
/* MARK: Footer
285291
*/
286292
footer {
@@ -523,6 +529,10 @@ nav {
523529
.sidebar-layout {
524530
display: none;
525531
}
532+
533+
main {
534+
margin: 0 2rem 2rem 2rem;
535+
}
526536
}
527537

528538
@media (min-width: 88em) {
@@ -770,6 +780,8 @@ button:has(~ .product-selector[style*="none"]) > .product-selector-button-icon {
770780
*/
771781

772782
.sidebar {
783+
--color-foreground: oklch(0 0 0 / 0.75);
784+
773785
display: flex;
774786
flex-direction: column;
775787
width: 22rem;
@@ -780,143 +792,145 @@ button:has(~ .product-selector[style*="none"]) > .product-selector-button-icon {
780792
padding-top: 1rem;
781793
align-items: start;
782794
overflow-y: auto;
783-
}
795+
color: var(--color-foreground);
784796

785-
/* Reset/Renormalize lists to remove default browser styling */
786-
.sidebar__container,
787-
.sidebar__container button,
788-
.sidebar__container ul,
789-
.sidebar__container li {
790-
margin: 0;
791-
padding: 0;
792-
list-style: none;
793-
font-weight: 400;
794-
font-size: 0.875rem;
795-
}
797+
/* Reset/Renormalize lists to remove default browser styling */
798+
.sidebar__container,
799+
.sidebar__container button,
800+
.sidebar__container ul,
801+
.sidebar__container li {
802+
margin: 0;
803+
padding: 0;
804+
list-style: none;
805+
font-weight: 400;
806+
font-size: 0.875rem;
807+
}
796808

797-
.sidebar__container {
798-
width: var(--sidebar-width);
799-
}
809+
.sidebar__container {
810+
width: var(--sidebar-width);
811+
}
800812

801-
.sidebar__container button {
802-
padding: 0.25rem 0.75rem;
803-
}
813+
.sidebar__container button {
814+
padding: 0.25rem 0.75rem;
815+
justify-content: space-between;
816+
}
804817

805-
.sidebar__content {
806-
padding: 0.5rem 0 0.4rem 0;
807-
}
818+
.sidebar__content {
819+
padding: 0.5rem 0 0.4rem 0;
820+
}
808821

809-
.sidebar__ul {
810-
padding-left: 0;
811-
}
822+
.sidebar__ul {
823+
padding-left: 0;
824+
}
812825

813-
.sidebar__children {
814-
padding-left: 1rem;
815-
}
826+
.sidebar__children {
827+
padding-left: 1rem;
828+
}
816829

817-
.sidebar__toggle {
818-
display: flex;
819-
align-items: center;
820-
gap: 0.25rem;
821-
cursor: pointer;
822-
background: none;
823-
border: none;
824-
width: 100%;
825-
text-align: left;
826-
padding: 0.25rem 0.5rem;
827-
border-radius: 5px 0 5px 0;
828-
font-weight: 500;
830+
.sidebar__toggle {
831+
display: flex;
832+
align-items: center;
833+
gap: 0.25rem;
834+
cursor: pointer;
835+
background: none;
836+
border: none;
837+
width: 100%;
838+
text-align: left;
839+
padding: 0.25rem 0.5rem;
840+
border-radius: 5px 0 5px 0;
841+
font-weight: 500;
842+
color: var(--color-foreground);
829843

830-
&:hover {
831-
background-color: oklch(var(--color-brand) / 0.06);
832-
color: oklch(var(--color-brand) / 1);
844+
&:hover {
845+
background-color: oklch(var(--color-brand) / 0.06);
846+
color: oklch(var(--color-brand) / 1);
847+
}
833848
}
834-
}
835849

836-
.sidebar__container button.sidebar__toggle--ancestor {
837-
font-weight: 600;
838-
}
850+
.sidebar__container button.sidebar__toggle--ancestor {
851+
font-weight: 600;
852+
}
839853

840-
.sidebar__chevron {
841-
display: flex;
842-
align-items: center;
843-
}
854+
.sidebar__chevron {
855+
display: flex;
856+
align-items: flex-end;
857+
}
844858

845-
.sidebar__chevron svg {
846-
margin-right: -0.325rem;
847-
stroke-width: 1.5;
848-
}
859+
.sidebar__chevron svg {
860+
stroke-width: 1.5;
861+
width: 1rem;
862+
height: 1rem;
863+
}
849864

850-
.sidebar__chevron--open {
851-
transform: rotate(90deg);
852-
}
865+
.sidebar__chevron--open {
866+
transform: rotate(90deg);
867+
}
853868

854-
.sidebar__toggle:has(.sidebar__chevron) {
855-
padding-left: .4rem;
856-
margin-left: -1rem;
857-
}
869+
.sidebar__toggle:not(:has(.sidebar__chevron)) {
870+
padding-left: 2rem;
871+
}
858872

859-
.sidebar__link {
860-
display: block;
861-
padding: 0.25rem 0.75rem;
862-
margin: 2px 0 2px 0;
863-
border-radius: 5px 0 5px 0;
864-
color: oklch(0 0 0 / 0.75);
865-
text-decoration: none;
866-
transition: background-color 0.2s ease, color 0.2s ease;
873+
.sidebar__link {
874+
display: block;
875+
padding: 0.25rem 0.75rem;
876+
margin: 2px 0 2px 0;
877+
border-radius: 5px 0 5px 0;
878+
color: oklch(0 0 0 / 0.75);
879+
text-decoration: none;
880+
transition: background-color 0.2s ease, color 0.2s ease;
867881

868-
&:hover {
869-
background-color: oklch(var(--color-brand) / 0.08);
870-
color: oklch(var(--color-brand));
882+
&:hover {
883+
background-color: oklch(var(--color-brand) / 0.08);
884+
color: oklch(var(--color-brand));
885+
}
871886
}
872-
}
873887

874-
.sidebar__link--current {
875-
color: oklch(var(--color-brand) / 1);
876-
background-color: oklch(var(--color-brand) / 0.1);
877-
font-weight: 600;
878-
display: block; /* Make it stretch horizontally clearly */
879-
width: auto; /* reset width clearly */
880-
box-sizing: border-box;
881-
}
882-
883-
.sidebar__toc {
884-
#TableOfContents {
885-
padding: 0 0.75rem 0 0;
886-
margin: 0.5rem 0.25rem 0.5rem 0.8rem;
887-
border-left: 1px solid var(--color-divider);
888-
color: oklch(0 0 0 / 0.75);
888+
.sidebar__link--current {
889+
color: oklch(var(--color-brand) / 1);
890+
background-color: oklch(var(--color-brand) / 0.1);
891+
font-weight: 600;
892+
display: block; /* Make it stretch horizontally clearly */
893+
width: auto; /* reset width clearly */
894+
box-sizing: border-box;
895+
}
889896

890-
a {
897+
.sidebar__toc {
898+
#TableOfContents {
899+
padding: 0 0.75rem 0 0;
900+
margin: 0.5rem 0.25rem 0.5rem 0.8rem;
901+
border-left: 1px solid var(--color-divider);
891902
color: oklch(0 0 0 / 0.75);
892-
text-decoration: none;
893-
}
894903

895-
&:empty {
896-
display: none;
897-
}
904+
a {
905+
color: oklch(0 0 0 / 0.75);
906+
text-decoration: none;
907+
}
898908

899-
li {
900-
padding: 0.25rem 0.75rem;
901-
}
909+
&:empty {
910+
display: none;
911+
}
902912

903-
li:first-child {
904-
padding-top: 0;
905-
}
913+
li {
914+
padding: 0.25rem 0.75rem;
915+
}
916+
917+
li:first-child {
918+
padding-top: 0;
919+
}
920+
921+
ul ul li:first-child {
922+
padding-top: 0.75rem;
923+
}
906924

907-
li:last-child {
908-
padding-bottom: 0;
925+
li:last-child {
926+
padding-bottom: 0;
927+
}
909928
}
910929
}
911930
}
912931

913932
/* MARK: Content
914933
*/
915-
main {
916-
flex: 1;
917-
min-width: 20rem;
918-
margin: 0 2rem 2rem 2rem;
919-
}
920934

921935
p {
922936
margin: 0;
@@ -1575,8 +1589,8 @@ hr {
15751589
}
15761590

15771591
.lucide {
1578-
width: 1.5rem;
1579-
height: 1.5rem;
1592+
width: 3rem;
1593+
height: 3rem;
15801594
stroke: currentColor;
15811595
fill: none;
15821596
stroke-width: 2;

layouts/partials/lucide.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{{- /* Usage: */ -}}
22
{{- /* (dict "context" . "icon" "circle") */ -}}
3-
<svg class="lucide" style="{{ .style | safeCSS }}" data-mf="true" style="display: none">
3+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" aria-hidden="true" class="lucide"
4+
style="{{ .style | safeCSS }}" data-mf="true" style="display: none">
45
<use href="/images/lucide-sprite.svg#{{ .icon }}"></use>
56
</svg>

layouts/partials/sidebar-list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
aria-expanded="{{ $shouldExpand }}"
1818
aria-controls="{{ $sectionID }}"
1919
>
20+
<span class="sidebar__toggle-text">{{ .Title }}</span>
2021
<span class="sidebar__chevron {{ if $shouldExpand }}sidebar__chevron--open{{ end }}">
2122
{{ partial "lucide" (dict "context" . "icon" "chevron-right") }}
2223
</span>
23-
<span class="sidebar__toggle-text">{{ .Title }}</span>
2424
</button>
2525
<div
2626
id="{{ $sectionID }}"

0 commit comments

Comments
 (0)