Skip to content

Commit 6f768a5

Browse files
committed
Refine sidebar and navigation styles for light/dark modes
1 parent 8f001b2 commit 6f768a5

File tree

2 files changed

+62
-9
lines changed

2 files changed

+62
-9
lines changed

src/components/react/LinkCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const LinkCard: React.FC<LinkCardProps> = ({
6363
className="block no-underline group"
6464
>
6565
<SpotlightCard
66-
className="h-full transition-colors hover:border-primary/30"
66+
className="h-full"
6767
spotlightColor="color-mix(in oklch, var(--primary) 15%, transparent)"
6868
>
6969
<div className="flex flex-col gap-3">

src/styles/custom.css

Lines changed: 61 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
/* Background colors */
186186
--sl-color-bg: oklch(0.147 0.004 49.25);
187187
--sl-color-bg-nav: oklch(0.18 0.005 49.25);
188-
--sl-color-bg-sidebar: oklch(0.16 0.004 49.25);
188+
--sl-color-bg-sidebar: oklch(0.147 0.004 49.25);
189189
--sl-color-bg-inline-code: oklch(0.25 0.007 34.298);
190190

191191
/* Border colors */
@@ -317,6 +317,27 @@ header.header {
317317
border-bottom-color: var(--sl-color-hairline);
318318
}
319319

320+
/* Dark mode - remove borders between sections (except header) */
321+
[data-theme='dark'] .sidebar-pane {
322+
border-inline-end: none;
323+
}
324+
325+
[data-theme='dark'] .right-sidebar {
326+
border-inline-start: none;
327+
}
328+
329+
[data-theme='dark'] .content-panel {
330+
border-top: none;
331+
}
332+
333+
[data-theme='dark'] nav.sidebar {
334+
border: none;
335+
}
336+
337+
[data-theme='dark'] .sidebar-content {
338+
border: none;
339+
}
340+
320341
/* Table styling */
321342
table {
322343
width: 100%;
@@ -364,22 +385,54 @@ h1, h2, h3, h4, h5, h6 {
364385
background-color: oklch(0.97 0 0) !important; /* #f5f5f5 neutral gray */
365386
}
366387

367-
[data-theme='light'] nav[aria-label="Main"] a[aria-current="page"] {
388+
[data-theme='light'] nav[aria-label="Main"] a[aria-current="page"],
389+
[data-theme='light'] nav[aria-label="Main"] a[aria-current="page"]:hover,
390+
[data-theme='light'] nav[aria-label="Main"] a[aria-current="page"]:focus {
368391
color: oklch(0.15 0 0) !important;
369-
background-color: oklch(0.97 0 0) !important; /* #f5f5f5 neutral gray */
392+
background-color: transparent !important;
370393
font-weight: 600;
371394
}
372395

396+
/* Nested sidebar items in light mode */
397+
[data-theme='light'] nav[aria-label="Main"] ul ul li {
398+
border-inline-start: 1px solid oklch(0 0 0 / 10%);
399+
border-radius: 0 0.5rem 0.5rem 0;
400+
}
401+
402+
[data-theme='light'] nav[aria-label="Main"] ul ul li:has(> a[aria-current="page"]) {
403+
border-inline-start: 2px solid oklch(0.5 0.2 285);
404+
}
405+
406+
[data-theme='light'] nav[aria-label="Main"] ul ul li:has(> a[aria-current="page"]) > a {
407+
margin-left: -1px;
408+
}
409+
373410
/* Sidebar navigation in dark mode */
374-
[data-theme='dark'] nav[aria-label="Main"] a:hover {
411+
[data-theme='dark'] nav[aria-label="Main"] a:hover,
412+
[data-theme='dark'] nav[aria-label="Main"] li:has(> a:hover) {
375413
color: oklch(0.98 0 0) !important;
376-
background-color: oklch(0.22 0 0) !important; /* lighter gray for visibility */
414+
background-color: oklch(0.22 0 0) !important;
377415
}
378416

379-
[data-theme='dark'] nav[aria-label="Main"] a[aria-current="page"] {
417+
[data-theme='dark'] nav[aria-label="Main"] a[aria-current="page"],
418+
[data-theme='dark'] nav[aria-label="Main"] a[aria-current="page"]:hover,
419+
[data-theme='dark'] nav[aria-label="Main"] a[aria-current="page"]:focus {
380420
color: oklch(0.98 0 0) !important;
381-
background-color: oklch(0.22 0 0) !important; /* lighter gray for visibility */
382-
font-weight: 600;
421+
background-color: transparent !important;
422+
}
423+
424+
/* Nested sidebar items get a left border indicator */
425+
[data-theme='dark'] nav[aria-label="Main"] ul ul li {
426+
border-inline-start: 1px solid oklch(1 0 0 / 10%);
427+
border-radius: 0 0.5rem 0.5rem 0;
428+
}
429+
430+
[data-theme='dark'] nav[aria-label="Main"] ul ul li:has(> a[aria-current="page"]) {
431+
border-inline-start: 2px solid var(--sl-color-accent);
432+
}
433+
434+
[data-theme='dark'] nav[aria-label="Main"] ul ul li:has(> a[aria-current="page"]) > a {
435+
margin-left: -1px;
383436
}
384437

385438
/* Sidebar group labels in light mode */

0 commit comments

Comments
 (0)