From 562c316c542a5fbcd3f91ff2a0fe65bddd20a477 Mon Sep 17 00:00:00 2001
From: nanxiyu <13981706105@163.com>
Date: Sat, 28 Feb 2026 23:35:34 +0800
Subject: [PATCH] 123
---
app/docs/[...slug]/page.tsx | 8 +--
app/globals.css | 103 +++++++++++++++++++++++++++++++++---
components/Sidebar.tsx | 6 ++-
components/ThemeToggle.tsx | 21 +++++++-
lib/docs.ts | 7 ++-
5 files changed, 129 insertions(+), 16 deletions(-)
diff --git a/app/docs/[...slug]/page.tsx b/app/docs/[...slug]/page.tsx
index bd2def4..18bf12a 100644
--- a/app/docs/[...slug]/page.tsx
+++ b/app/docs/[...slug]/page.tsx
@@ -38,11 +38,11 @@ export default async function DocPage({ params }: { params: Promise<{ slug: stri
return (
- {doc.meta.title}
- {doc.meta.description && (
- {doc.meta.description}
+ {doc!.meta.title}
+ {doc!.meta.description && (
+ {doc!.meta.description}
)}
-
+
);
}
diff --git a/app/globals.css b/app/globals.css
index be1068e..960abff 100644
--- a/app/globals.css
+++ b/app/globals.css
@@ -114,6 +114,68 @@ body {
letter-spacing: 0.05em;
}
+/* Theme Toggle Button */
+.theme-toggle {
+ background: transparent;
+ border: 1px solid var(--border-color);
+ backdrop-filter: blur(8px);
+ -webkit-backdrop-filter: blur(8px);
+ border-radius: 9999px;
+ width: 38px;
+ height: 38px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ cursor: pointer;
+ color: var(--text-secondary);
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
+ overflow: hidden;
+ position: relative;
+}
+
+.theme-toggle:hover {
+ background: var(--bg-secondary);
+ color: var(--text-primary);
+ border-color: var(--text-muted);
+ box-shadow: 0 0 10px var(--accent-glow);
+}
+
+.theme-toggle-icon-wrapper {
+ position: relative;
+ width: 20px;
+ height: 20px;
+}
+
+.theme-toggle-sun,
+.theme-toggle-moon {
+ position: absolute;
+ top: 0;
+ left: 0;
+ transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
+}
+
+/* Light Mode State */
+.theme-toggle.is-light .theme-toggle-sun {
+ opacity: 1;
+ transform: rotate(0deg) scale(1);
+}
+
+.theme-toggle.is-light .theme-toggle-moon {
+ opacity: 0;
+ transform: rotate(90deg) scale(0);
+}
+
+/* Dark Mode State */
+.theme-toggle.is-dark .theme-toggle-sun {
+ opacity: 0;
+ transform: rotate(-90deg) scale(0);
+}
+
+.theme-toggle.is-dark .theme-toggle-moon {
+ opacity: 1;
+ transform: rotate(0deg) scale(1);
+}
+
.sidebar-nav {
flex: 1;
overflow-y: auto;
@@ -166,9 +228,16 @@ body {
}
.sidebar-section-arrow {
- font-size: 0.6rem;
+ display: flex;
+ align-items: center;
+ justify-content: center;
color: var(--text-muted);
- transition: transform 0.2s ease;
+ transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
+}
+
+.sidebar-section-arrow svg {
+ width: 1rem;
+ height: 1rem;
}
.sidebar-section-arrow.open {
@@ -210,6 +279,30 @@ body {
font-weight: 500;
}
+/* --- DocPage container and hero --- */
+.doc-page-container {
+ max-width: 800px;
+ margin: 0 auto;
+}
+
+.doc-page-title {
+ font-size: 2.5rem;
+ font-weight: 800;
+ color: var(--text-primary);
+ letter-spacing: -0.03em;
+ line-height: 1.2;
+ margin: 0 0 1rem 0;
+}
+
+.doc-page-description {
+ font-size: 1.125rem;
+ color: var(--text-muted);
+ margin: 0 0 2.5rem 0;
+ line-height: 1.6;
+ border-bottom: 1px solid var(--border-color);
+ padding-bottom: 2rem;
+}
+
/* --- DocContent (Markdown) Styles --- */
.doc-article {
color: var(--text-primary);
@@ -365,10 +458,4 @@ body {
border: 0;
border-top: 1px solid var(--border-color);
margin: 3rem 0;
-}
-
-/* Title container wrapper inside article to strip Tailwind prose max-width constraint */
-article {
- max-width: 800px;
- margin: 0 auto;
}
\ No newline at end of file
diff --git a/components/Sidebar.tsx b/components/Sidebar.tsx
index 8422a5b..9561fbf 100644
--- a/components/Sidebar.tsx
+++ b/components/Sidebar.tsx
@@ -60,7 +60,11 @@ export function Sidebar({ sidebarData, currentSlug }: SidebarProps) {
onClick={() => toggleSection(item.slug)}
>
{item.title}
- ▶
+
+
+
{isOpen && (
diff --git a/components/ThemeToggle.tsx b/components/ThemeToggle.tsx
index 57fcbed..33d766f 100644
--- a/components/ThemeToggle.tsx
+++ b/components/ThemeToggle.tsx
@@ -19,11 +19,28 @@ export function ThemeToggle() {
return (
);
}
diff --git a/lib/docs.ts b/lib/docs.ts
index 3ce26b4..3d71fb4 100644
--- a/lib/docs.ts
+++ b/lib/docs.ts
@@ -98,11 +98,16 @@ export const getDocBySlug = cache(async (slug: string[]): Promise