Skip to content

Commit 3f735e7

Browse files
authored
Refactor header and add left sidebar navigation styles
Removed unused clock element and center header section. Added left sidebar navigation and menu toggle styles.
1 parent 088d366 commit 3f735e7

1 file changed

Lines changed: 105 additions & 120 deletions

File tree

cn_webviewer/styles.css

Lines changed: 105 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -79,23 +79,14 @@ body {
7979
flex: 1;
8080
display: flex;
8181
align-items: center;
82+
justify-content: flex-start; /* Keep title on left */
8283
}
8384

84-
.clock {
85-
font-size: 0.95rem;
86-
font-weight: 500;
87-
color: var(--text-secondary);
88-
font-family: 'Monaco', 'Courier New', monospace;
89-
padding: 0.5rem 1rem;
90-
background: var(--bg-secondary);
91-
border-radius: 8px;
92-
border: 1px solid var(--border-color);
93-
}
85+
/* Clock removed - no longer needed */
9486

9587
.header-center {
96-
flex: 2;
97-
display: flex;
98-
justify-content: center;
88+
flex: 0; /* Remove center section */
89+
display: none; /* Hide the center completely */
9990
}
10091

10192
.site-title {
@@ -135,6 +126,27 @@ body {
135126
}
136127

137128
/* Home Button */
129+
.menu-toggle {
130+
background: var(--bg-secondary);
131+
border: 1px solid var(--border-color);
132+
border-radius: 8px;
133+
padding: 0.6rem 0.8rem;
134+
cursor: pointer;
135+
font-size: 1.2rem;
136+
color: var(--text-primary);
137+
transition: all 0.2s ease;
138+
display: flex;
139+
align-items: center;
140+
justify-content: center;
141+
margin-right: 1rem;
142+
}
143+
144+
.menu-toggle:hover {
145+
background: var(--accent-color);
146+
color: white;
147+
transform: scale(1.05);
148+
}
149+
138150
.home-button {
139151
background: var(--bg-secondary);
140152
border: 1px solid var(--border-color);
@@ -177,12 +189,7 @@ body {
177189
}
178190

179191
.search-hint {
180-
font-size: 0.75rem;
181-
font-family: 'Monaco', monospace;
182-
padding: 0.15rem 0.4rem;
183-
background: var(--bg-primary);
184-
border-radius: 4px;
185-
border: 1px solid var(--border-color);
192+
display: none; /* Hide Ctrl+K hint */
186193
}
187194

188195
/* Theme Toggle Button */
@@ -261,147 +268,87 @@ body {
261268
}
262269

263270
/* ============================================
264-
Search Modal
271+
Left Sidebar Navigation
265272
============================================ */
266-
.search-modal {
273+
.left-sidebar {
267274
position: fixed;
268-
top: 0;
269275
left: 0;
270-
right: 0;
276+
top: var(--header-height);
271277
bottom: 0;
272-
background: rgba(0, 0, 0, 0.7);
273-
backdrop-filter: blur(4px);
274-
z-index: 2000;
275-
display: none;
276-
align-items: flex-start;
277-
justify-content: center;
278-
padding-top: 10vh;
279-
animation: fadeIn 0.2s ease;
280-
}
281-
282-
.search-modal.active {
283-
display: flex;
284-
}
285-
286-
@keyframes fadeIn {
287-
from { opacity: 0; }
288-
to { opacity: 1; }
278+
width: 280px;
279+
background: var(--bg-secondary);
280+
border-right: 1px solid var(--border-color);
281+
overflow-y: auto;
282+
overflow-x: hidden;
283+
transition: transform 0.3s ease;
284+
z-index: 900;
285+
padding: 1.5rem 0;
289286
}
290287

291-
.search-modal-content {
292-
width: 90%;
293-
max-width: 700px;
294-
background: var(--bg-primary);
295-
border-radius: 12px;
296-
box-shadow: 0 20px 60px var(--shadow);
297-
overflow: hidden;
298-
animation: slideDown 0.3s ease;
288+
.left-sidebar.hidden {
289+
transform: translateX(-100%);
299290
}
300291

301-
@keyframes slideDown {
302-
from { transform: translateY(-50px); opacity: 0; }
303-
to { transform: translateY(0); opacity: 1; }
292+
.main-navigation {
293+
padding: 0 1.5rem;
304294
}
305295

306-
.search-box {
307-
display: flex;
308-
align-items: center;
309-
gap: 1rem;
310-
padding: 1.5rem;
311-
border-bottom: 2px solid var(--border-color);
296+
.main-navigation ul {
297+
list-style: none;
298+
padding: 0;
299+
margin: 0;
312300
}
313301

314-
.search-box i {
315-
font-size: 1.2rem;
316-
color: var(--text-secondary);
302+
.main-navigation li {
303+
margin-bottom: 0.5rem;
317304
}
318305

319-
.search-box input {
320-
flex: 1;
321-
background: none;
322-
border: none;
323-
outline: none;
324-
font-size: 1.1rem;
306+
.main-navigation a {
307+
display: block;
325308
color: var(--text-primary);
326-
font-family: inherit;
327-
}
328-
329-
.search-close {
330-
background: var(--bg-secondary);
331-
border: 1px solid var(--border-color);
309+
text-decoration: none;
310+
padding: 0.5rem 0.75rem;
332311
border-radius: 6px;
333-
padding: 0.4rem 0.6rem;
334-
cursor: pointer;
335-
color: var(--text-secondary);
336312
transition: all 0.2s ease;
313+
font-size: 0.95rem;
337314
}
338315

339-
.search-close:hover {
316+
.main-navigation a:hover {
340317
background: var(--accent-color);
341318
color: white;
319+
transform: translateX(4px);
342320
}
343321

344-
.search-results {
345-
max-height: 60vh;
346-
overflow-y: auto;
347-
padding: 1rem;
348-
}
349-
350-
.search-placeholder {
351-
text-align: center;
352-
color: var(--text-secondary);
353-
padding: 2rem;
354-
}
355-
356-
.search-result-item {
357-
padding: 1rem;
358-
border-radius: 8px;
359-
cursor: pointer;
360-
transition: all 0.2s ease;
361-
margin-bottom: 0.5rem;
362-
border: 1px solid transparent;
363-
}
364-
365-
.search-result-item:hover {
366-
background: var(--bg-secondary);
367-
border-color: var(--accent-color);
368-
}
369-
370-
.search-result-title {
371-
font-weight: 600;
372-
color: var(--text-primary);
373-
margin-bottom: 0.3rem;
374-
}
375-
376-
.search-result-path {
377-
font-size: 0.85rem;
378-
color: var(--text-secondary);
379-
margin-bottom: 0.3rem;
322+
.main-navigation ul ul {
323+
margin-left: 1rem;
324+
margin-top: 0.25rem;
380325
}
381326

382-
.search-result-content {
327+
.main-navigation ul ul a {
383328
font-size: 0.9rem;
384329
color: var(--text-secondary);
385-
line-height: 1.5;
386330
}
387331

388-
.search-highlight {
389-
background: var(--accent-color);
332+
.main-navigation ul ul a:hover {
390333
color: white;
391-
padding: 0.1rem 0.2rem;
392-
border-radius: 3px;
393334
}
394335

395336
/* ============================================
396337
Main Content Area
397338
============================================ */
398339
main.container {
399340
margin-top: var(--header-height);
341+
margin-left: 280px; /* Space for left sidebar */
400342
min-height: calc(100vh - var(--header-height));
401343
padding: 3rem 2rem;
402344
display: flex;
403345
justify-content: center;
404346
position: relative;
347+
transition: margin-left 0.3s ease;
348+
}
349+
350+
main.container.sidebar-hidden {
351+
margin-left: 0;
405352
}
406353

407354
.content-wrapper {
@@ -692,7 +639,33 @@ main.container {
692639
============================================ */
693640
@media (max-width: 1400px) {
694641
.toc-wrapper {
695-
display: none;
642+
/* Keep the TOC but make it toggleable */
643+
position: fixed;
644+
right: -320px;
645+
top: var(--header-height);
646+
bottom: 0;
647+
width: 300px;
648+
transition: right 0.3s ease;
649+
z-index: 999;
650+
box-shadow: -2px 0 10px var(--shadow);
651+
}
652+
653+
.toc-wrapper.expanded {
654+
right: 0;
655+
}
656+
657+
.toc-toggle {
658+
display: flex !important;
659+
position: fixed;
660+
right: 10px;
661+
top: calc(var(--header-height) + 10px);
662+
z-index: 1000;
663+
background: var(--accent-color);
664+
color: white;
665+
border: none;
666+
padding: 0.75rem 1rem;
667+
border-radius: 8px;
668+
box-shadow: 0 2px 8px var(--shadow);
696669
}
697670
}
698671

@@ -768,6 +741,18 @@ main.container {
768741
main.container {
769742
padding: 2rem 1rem;
770743
margin-top: calc(var(--header-height) + 1rem);
744+
margin-left: 0 !important; /* No left margin on mobile */
745+
}
746+
747+
/* Left Sidebar on Mobile */
748+
.left-sidebar {
749+
transform: translateX(-100%);
750+
box-shadow: 2px 0 10px var(--shadow);
751+
z-index: 1100;
752+
}
753+
754+
.left-sidebar:not(.hidden) {
755+
transform: translateX(0);
771756
}
772757

773758
.markdown-body h1 {
@@ -840,4 +825,4 @@ main.container {
840825

841826
::-webkit-scrollbar-thumb:hover {
842827
background: var(--accent-color);
843-
}
828+
}

0 commit comments

Comments
 (0)