Skip to content

Commit e910ec4

Browse files
authored
feat(docs): scrollbar styling (#69)
This PR adds scrollbar styling for the sidebar, code blocks, and the page.
1 parent 931d459 commit e910ec4

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

docs/src/components/Sidebar.module.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ article ~ .root {
107107
padding: 4rem 1rem 1rem 1rem;
108108
width: 100%;
109109
z-index: 10;
110-
overflow: auto;
110+
overflow-x: hidden;
111+
overflow-y: auto;
111112
pointer-events: auto;
112113
/* view-transition-name: sidebar; */
113114

docs/src/pages/global.css

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ body {
1212
padding: 0;
1313
min-height: 100vh;
1414
width: 100%;
15+
scrollbar-width: auto;
16+
scrollbar-color: theme("colors.gray.200") transparent;
1517
}
1618

1719
html {
@@ -26,6 +28,39 @@ body {
2628
@apply flex flex-col w-full overflow-x-hidden from-white to-gray-200 bg-gradient-to-b dark:from-zinc-800 dark:to-zinc-900 dark:bg-gradient-to-b dark:text-gray-300;
2729
}
2830

31+
aside,
32+
pre {
33+
scrollbar-width: thin;
34+
}
35+
36+
aside {
37+
scrollbar-color: theme("colors.gray.200") transparent;
38+
}
39+
40+
pre {
41+
scrollbar-color: theme("colors.gray.600") transparent;
42+
}
43+
44+
@media (prefers-color-scheme: dark) {
45+
html:not(.light) aside {
46+
scrollbar-color: theme("colors.gray.600") transparent;
47+
}
48+
}
49+
50+
html.dark aside {
51+
scrollbar-color: theme("colors.gray.600") transparent;
52+
}
53+
54+
@media (prefers-color-scheme: dark) {
55+
html:not(.light) {
56+
scrollbar-color: theme("colors.gray.600") transparent;
57+
}
58+
}
59+
60+
html.dark {
61+
scrollbar-color: theme("colors.gray.600") transparent;
62+
}
63+
2964
main {
3065
@apply container max-w-screen-xl mx-auto flex flex-col flex-1 bg-transparent;
3166

0 commit comments

Comments
 (0)