Skip to content

Commit 24ae34b

Browse files
committed
updated the sidebar design
1 parent 15816cb commit 24ae34b

File tree

1 file changed

+137
-0
lines changed

1 file changed

+137
-0
lines changed

src/css/custom.css

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,143 @@ body {
8585
background-color: inherit;
8686
}
8787

88+
/* ===== SIDEBAR CUSTOMIZATION ===== */
89+
90+
/* Make child/nested sidebar items smaller */
91+
.theme-doc-sidebar-item-link-level-1,
92+
.theme-doc-sidebar-item-category-level-1 {
93+
font-size: 0.9rem;
94+
padding-left: 1rem;
95+
}
96+
97+
.theme-doc-sidebar-item-link-level-2,
98+
.theme-doc-sidebar-item-category-level-2 {
99+
font-size: 0.85rem;
100+
padding-left: 0.5rem;
101+
}
102+
103+
.theme-doc-sidebar-item-link-level-3,
104+
.theme-doc-sidebar-item-category-level-3 {
105+
font-size: 0.8rem;
106+
padding-left: 0.5rem;
107+
}
108+
109+
.menu__link:hover, .menu__caret:hover {
110+
background: transparent !important;
111+
}
112+
113+
/* Style for top-level sidebar items */
114+
.theme-doc-sidebar-item-link-level-0,
115+
.theme-doc-sidebar-item-category-level-0 {
116+
font-size: 1rem;
117+
font-weight: 500;
118+
}
119+
120+
/* Remove the caret box styling and make it cleaner */
121+
.menu__list-item--collapsible .menu__caret {
122+
background: none !important;
123+
border: none !important;
124+
box-shadow: none !important;
125+
padding: 0 !important;
126+
margin-right: 0.5rem;
127+
width: auto !important;
128+
height: auto !important;
129+
min-width: auto !important;
130+
}
131+
132+
/* Remove hover effects on caret specifically */
133+
.menu__list-item--collapsible .menu__caret:hover {
134+
background: none !important;
135+
border: none !important;
136+
box-shadow: none !important;
137+
}
138+
139+
/* Style the caret icon itself */
140+
.menu__list-item--collapsible .menu__caret:before {
141+
content: '▶';
142+
font-size: 0.5rem;
143+
color: var(--ifm-color-emphasis-600);
144+
transition: transform 0.2s ease;
145+
}
146+
147+
/* Rotate caret when expanded */
148+
.menu__list-item--collapsible .menu__list-item-collapsible--active .menu__caret:before {
149+
transform: rotate(90deg);
150+
}
151+
152+
/* Adjust spacing for collapsible items */
153+
.menu__list-item--collapsible .menu__link {
154+
padding-left: 0;
155+
}
156+
157+
/* Remove any default button styling from caret */
158+
.menu__caret {
159+
appearance: none;
160+
-webkit-appearance: none;
161+
-moz-appearance: none;
162+
outline: none;
163+
cursor: pointer;
164+
}
165+
166+
/* Make nested items more visually distinct */
167+
.menu__list .menu__list {
168+
border-left: 1px solid var(--ifm-color-emphasis-200);
169+
margin-left: 0.75rem;
170+
padding-left: 0.5rem;
171+
}
172+
173+
[data-theme='dark'] .menu__list .menu__list {
174+
border-left-color: var(--ifm-color-emphasis-300);
175+
}
176+
177+
/* Reduce spacing between sidebar items */
178+
.menu__list-item:not(:first-child) {
179+
margin-top: 0.25rem;
180+
}
181+
182+
/* Style active sidebar items */
183+
.menu__link--active {
184+
font-weight: 600;
185+
background-color: var(--ifm-color-primary-lightest);
186+
border-radius: 4px;
187+
}
188+
189+
[data-theme='dark'] .menu__link--active {
190+
background-color: var(--ifm-color-primary-darkest);
191+
}
192+
193+
/* Hover effects for sidebar items */
194+
.menu__link:hover {
195+
background-color: var(--ifm-color-emphasis-100);
196+
border-radius: 6px;
197+
transition: background-color 0.2s ease, transform 0.1s ease;
198+
}
199+
200+
[data-theme='dark'] .menu__link:hover {
201+
background-color: var(--ifm-color-emphasis-200);
202+
}
203+
204+
/* Ensure collapsible items don't get unwanted hover boxes */
205+
.menu__list-item--collapsible:hover {
206+
background: none !important;
207+
}
208+
209+
/* More refined hover for the entire menu item container */
210+
.menu__list-item:hover {
211+
background: none;
212+
}
213+
214+
/* Only apply hover to the actual link, not the container */
215+
.menu__list-item .menu__link:not(.menu__caret):hover {
216+
background-color: var(--ifm-color-emphasis-100);
217+
border-radius: 6px;
218+
transform: translateX(2px);
219+
}
220+
221+
[data-theme='dark'] .menu__list-item .menu__link:not(.menu__caret):hover {
222+
background-color: var(--ifm-color-emphasis-200);
223+
}
224+
88225
[data-theme="dark"] .navbar {
89226
background-color: rgba(34, 31, 29, 0.9);
90227
}

0 commit comments

Comments
 (0)