diff --git a/package-lock.json b/package-lock.json
index 203c037..5f48068 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10,14 +10,10 @@
"dependencies": {
"@fontsource-variable/geist": "^5.2.9",
"@tailwindcss/vite": "^4.3.0",
- "class-variance-authority": "^0.7.1",
- "clsx": "^2.1.1",
"lucide-react": "^1.17.0",
"react": "^19.2.6",
"react-dom": "^19.2.6",
- "tailwind-merge": "^3.6.0",
- "tailwindcss": "^4.3.0",
- "tw-animate-css": "^1.4.0"
+ "tailwindcss": "^4.3.0"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
@@ -1562,27 +1558,6 @@
],
"license": "CC-BY-4.0"
},
- "node_modules/class-variance-authority": {
- "version": "0.7.1",
- "resolved": "https://registry.npmjs.org/class-variance-authority/-/class-variance-authority-0.7.1.tgz",
- "integrity": "sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg==",
- "license": "Apache-2.0",
- "dependencies": {
- "clsx": "^2.1.1"
- },
- "funding": {
- "url": "https://polar.sh/cva"
- }
- },
- "node_modules/clsx": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
- "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",
- "license": "MIT",
- "engines": {
- "node": ">=6"
- }
- },
"node_modules/convert-source-map": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
@@ -2759,16 +2734,6 @@
"node": ">=0.10.0"
}
},
- "node_modules/tailwind-merge": {
- "version": "3.6.0",
- "resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-3.6.0.tgz",
- "integrity": "sha512-uxL7qAVQriqRQPAyK3pj66VqskWqoZ37PW94jwOTwNfq/z9oyu1V+eqrZqtR2+fCiXdYOZe/Modt8GtvqNzu+w==",
- "license": "MIT",
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/dcastil"
- }
- },
"node_modules/tailwindcss": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.3.0.tgz",
@@ -2824,15 +2789,6 @@
"license": "0BSD",
"optional": true
},
- "node_modules/tw-animate-css": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/tw-animate-css/-/tw-animate-css-1.4.0.tgz",
- "integrity": "sha512-7bziOlRqH0hJx80h/3mbicLW7o8qLsH5+RaLR2t+OHM3D0JlWGODQKQ4cxbK7WlvmUxpcj6Kgu6EKqjrGFe3QQ==",
- "license": "MIT",
- "funding": {
- "url": "https://github.com/sponsors/Wombosvideo"
- }
- },
"node_modules/type-check": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
diff --git a/package.json b/package.json
index fb0c4ec..c4a1623 100644
--- a/package.json
+++ b/package.json
@@ -12,14 +12,10 @@
"dependencies": {
"@fontsource-variable/geist": "^5.2.9",
"@tailwindcss/vite": "^4.3.0",
- "class-variance-authority": "^0.7.1",
- "clsx": "^2.1.1",
"lucide-react": "^1.17.0",
"react": "^19.2.6",
"react-dom": "^19.2.6",
- "tailwind-merge": "^3.6.0",
- "tailwindcss": "^4.3.0",
- "tw-animate-css": "^1.4.0"
+ "tailwindcss": "^4.3.0"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
diff --git a/public/banner.jpg b/public/banner.jpg
deleted file mode 100644
index f1ed46e..0000000
Binary files a/public/banner.jpg and /dev/null differ
diff --git a/src/App.tsx b/src/App.tsx
index 071fa1c..25f0ccc 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,22 +1,14 @@
-import Banner from "./components/Banner";
-import AboutSection from "./components/sections/AboutSection";
-import ProjectsSection from "./components/sections/ProjectsSection";
-import ContactSection from "./components/sections/ContactSection";
-import MorePage from "./pages/MorePage";
-
-export default function App() {
- const { pathname } = window.location;
-
- if (/^\/more(\/index\.html)?\/?$/.test(pathname)) {
- return ;
- }
-
- return (
-
- );
-}
\ No newline at end of file
+import { useEffect } from "react";
+import { useRoute } from "@/router";
+
+// Resolves the current path to a page via the route registry.
+export default function App() {
+ const { route } = useRoute();
+
+ useEffect(() => {
+ document.title = route.title;
+ }, [route.title]);
+
+ const { Component } = route;
+ return ;
+}
diff --git a/src/components/NavCard.tsx b/src/components/NavCard.tsx
index 5367f7a..bf46e2c 100644
--- a/src/components/NavCard.tsx
+++ b/src/components/NavCard.tsx
@@ -1,20 +1,19 @@
+import { Link } from "@/router";
import type { NavItem } from "@/types";
interface NavCardProps {
item: NavItem;
}
-// A clickable navigation card with icon, title, and description
+// A clickable navigation card with icon, title, and description.
+// Internal paths ("/...") route client-side; external URLs open in a new tab.
export default function NavCard({ item }: NavCardProps) {
const { name, desc, path, Icon, color, borderHover } = item;
- return (
-
+ const className = `flex items-center md:flex-col md:text-center gap-5 md:gap-4 p-6 md:py-8 rounded-2xl bg-black/35 backdrop-blur-md border border-white/5 transition-all duration-300 cursor-pointer hover:-translate-y-1 hover:bg-black/45 ${borderHover} group`;
+
+ const content = (
+ <>
@@ -26,6 +25,20 @@ export default function NavCard({ item }: NavCardProps) {
{desc}
+ >
+ );
+
+ if (path.startsWith("/")) {
+ return (
+
+ {content}
+
+ );
+ }
+
+ return (
+
+ {content}
);
}
diff --git a/src/data/navigation.ts b/src/data/navigation.ts
index 44eb9b5..fa60473 100644
--- a/src/data/navigation.ts
+++ b/src/data/navigation.ts
@@ -1,5 +1,4 @@
-import { LayoutDashboard, ListCollapse } from "lucide-react";
-// GitFork, MonitorCog, Workflow
+import { LayoutDashboard, ListCollapse } from "lucide-react";
import type { NavItem } from "@/types";
// External links displayed as navigation cards on the banner
diff --git a/src/index.css b/src/index.css
index 926708a..ab4d769 100644
--- a/src/index.css
+++ b/src/index.css
@@ -1,129 +1,16 @@
@import "tailwindcss";
-@import "tw-animate-css";
@import "@fontsource-variable/geist";
-@custom-variant dark (&:is(.dark *));
-
-@theme inline {
- --font-heading: var(--font-sans);
- --font-sans: 'Geist Variable', sans-serif;
- --color-sidebar-ring: var(--sidebar-ring);
- --color-sidebar-border: var(--sidebar-border);
- --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
- --color-sidebar-accent: var(--sidebar-accent);
- --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
- --color-sidebar-primary: var(--sidebar-primary);
- --color-sidebar-foreground: var(--sidebar-foreground);
- --color-sidebar: var(--sidebar);
- --color-chart-5: var(--chart-5);
- --color-chart-4: var(--chart-4);
- --color-chart-3: var(--chart-3);
- --color-chart-2: var(--chart-2);
- --color-chart-1: var(--chart-1);
- --color-ring: var(--ring);
- --color-input: var(--input);
- --color-border: var(--border);
- --color-destructive: var(--destructive);
- --color-accent-foreground: var(--accent-foreground);
- --color-accent: var(--accent);
- --color-muted-foreground: var(--muted-foreground);
- --color-muted: var(--muted);
- --color-secondary-foreground: var(--secondary-foreground);
- --color-secondary: var(--secondary);
- --color-primary-foreground: var(--primary-foreground);
- --color-primary: var(--primary);
- --color-popover-foreground: var(--popover-foreground);
- --color-popover: var(--popover);
- --color-card-foreground: var(--card-foreground);
- --color-card: var(--card);
- --color-foreground: var(--foreground);
- --color-background: var(--background);
- --radius-sm: calc(var(--radius) * 0.6);
- --radius-md: calc(var(--radius) * 0.8);
- --radius-lg: var(--radius);
- --radius-xl: calc(var(--radius) * 1.4);
- --radius-2xl: calc(var(--radius) * 1.8);
- --radius-3xl: calc(var(--radius) * 2.2);
- --radius-4xl: calc(var(--radius) * 2.6);
-}
-
-:root {
- --background: oklch(1 0 0);
- --foreground: oklch(0.145 0 0);
- --card: oklch(1 0 0);
- --card-foreground: oklch(0.145 0 0);
- --popover: oklch(1 0 0);
- --popover-foreground: oklch(0.145 0 0);
- --primary: oklch(0.205 0 0);
- --primary-foreground: oklch(0.985 0 0);
- --secondary: oklch(0.97 0 0);
- --secondary-foreground: oklch(0.205 0 0);
- --muted: oklch(0.97 0 0);
- --muted-foreground: oklch(0.556 0 0);
- --accent: oklch(0.97 0 0);
- --accent-foreground: oklch(0.205 0 0);
- --destructive: oklch(0.577 0.245 27.325);
- --border: oklch(0.922 0 0);
- --input: oklch(0.922 0 0);
- --ring: oklch(0.708 0 0);
- --chart-1: oklch(0.87 0 0);
- --chart-2: oklch(0.556 0 0);
- --chart-3: oklch(0.439 0 0);
- --chart-4: oklch(0.371 0 0);
- --chart-5: oklch(0.269 0 0);
- --radius: 0.625rem;
- --sidebar: oklch(0.985 0 0);
- --sidebar-foreground: oklch(0.145 0 0);
- --sidebar-primary: oklch(0.205 0 0);
- --sidebar-primary-foreground: oklch(0.985 0 0);
- --sidebar-accent: oklch(0.97 0 0);
- --sidebar-accent-foreground: oklch(0.205 0 0);
- --sidebar-border: oklch(0.922 0 0);
- --sidebar-ring: oklch(0.708 0 0);
-}
-
-.dark {
- --background: oklch(0.145 0 0);
- --foreground: oklch(0.985 0 0);
- --card: oklch(0.205 0 0);
- --card-foreground: oklch(0.985 0 0);
- --popover: oklch(0.205 0 0);
- --popover-foreground: oklch(0.985 0 0);
- --primary: oklch(0.922 0 0);
- --primary-foreground: oklch(0.205 0 0);
- --secondary: oklch(0.269 0 0);
- --secondary-foreground: oklch(0.985 0 0);
- --muted: oklch(0.269 0 0);
- --muted-foreground: oklch(0.708 0 0);
- --accent: oklch(0.269 0 0);
- --accent-foreground: oklch(0.985 0 0);
- --destructive: oklch(0.704 0.191 22.216);
- --border: oklch(1 0 0 / 10%);
- --input: oklch(1 0 0 / 15%);
- --ring: oklch(0.556 0 0);
- --chart-1: oklch(0.87 0 0);
- --chart-2: oklch(0.556 0 0);
- --chart-3: oklch(0.439 0 0);
- --chart-4: oklch(0.371 0 0);
- --chart-5: oklch(0.269 0 0);
- --sidebar: oklch(0.205 0 0);
- --sidebar-foreground: oklch(0.985 0 0);
- --sidebar-primary: oklch(0.488 0.243 264.376);
- --sidebar-primary-foreground: oklch(0.985 0 0);
- --sidebar-accent: oklch(0.269 0 0);
- --sidebar-accent-foreground: oklch(0.985 0 0);
- --sidebar-border: oklch(1 0 0 / 10%);
- --sidebar-ring: oklch(0.556 0 0);
+@theme {
+ --font-sans: "Geist Variable", system-ui, sans-serif;
}
@layer base {
- * {
- @apply border-border outline-ring/50;
- }
- body {
- @apply bg-background text-foreground;
- }
html {
- @apply font-sans;
- }
-}
\ No newline at end of file
+ font-family: var(--font-sans);
+ }
+
+ body {
+ @apply bg-black text-white antialiased;
+ }
+}
diff --git a/src/lib/utils.ts b/src/lib/utils.ts
deleted file mode 100644
index f829366..0000000
--- a/src/lib/utils.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { clsx, type ClassValue } from "clsx"
-import { twMerge } from "tailwind-merge"
-
-// Merges Tailwind classes, resolving conflicts via tailwind-merge
-export function cn(...inputs: ClassValue[]) {
- return twMerge(clsx(inputs))
-}
diff --git a/src/pages/HomePage.tsx b/src/pages/HomePage.tsx
new file mode 100644
index 0000000..0a6ccce
--- /dev/null
+++ b/src/pages/HomePage.tsx
@@ -0,0 +1,16 @@
+import Banner from "@/components/Banner";
+import AboutSection from "@/components/sections/AboutSection";
+import ProjectsSection from "@/components/sections/ProjectsSection";
+import ContactSection from "@/components/sections/ContactSection";
+
+// Landing page: hero banner followed by the content sections.
+export default function HomePage() {
+ return (
+
+ );
+}
diff --git a/src/pages/MorePage.tsx b/src/pages/MorePage.tsx
index 4b3a752..22ff7b8 100644
--- a/src/pages/MorePage.tsx
+++ b/src/pages/MorePage.tsx
@@ -1,5 +1,7 @@
-import { useEffect } from "react";
-import "./more.css";
+import { Link } from "@/router";
+import Header from "@/components/layout/Header";
+import Footer from "@/components/layout/Footer";
+import bannerImg from "@/assets/banner.png";
const appIcons = {
water: ,
@@ -17,31 +19,55 @@ const apps = [
{ name: "力的课题", desc: "认识三种基本的力", color: "#ef4444", link: "/forces.html", icon: appIcons.atom },
];
+// App hub at /more, styled to match the main site's terminal aesthetic.
export default function MorePage() {
- useEffect(() => {
- document.title = "更多应用";
- }, []);
-
return (
-
-
-
+
+
-
+
+
+
+
+
+ 更多应用
+
+
+ {"< 一个入口,汇聚所有工具 >"}
+
+
+
+ 返回主站
+
+
+
+
+
+
+
);
}
diff --git a/src/pages/more.css b/src/pages/more.css
deleted file mode 100644
index f54ab0a..0000000
--- a/src/pages/more.css
+++ /dev/null
@@ -1,167 +0,0 @@
-.more-page {
- position: relative;
- min-height: 100svh;
- box-sizing: border-box;
- color: #94a3b8;
- font-family: system-ui, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
-}
-
-.more-page::before {
- content: "";
- position: fixed;
- inset: 0;
- z-index: -1;
- background: linear-gradient(rgba(15, 23, 42, 0.6), rgba(15, 23, 42, 0.6)),
- url("/banner.jpg") center / cover no-repeat, #0f172a;
-}
-
-.more-page *,
-.more-page *::before,
-.more-page *::after {
- box-sizing: inherit;
-}
-
-.more-page-inner {
- max-width: 1120px;
- margin: 0 auto;
- padding: 0 24px 64px;
-}
-
-.more-banner {
- position: relative;
- text-align: center;
- padding: 88px 24px;
- margin: 32px 0 48px;
- border-radius: 20px;
- background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
- border: 1px solid rgba(255, 255, 255, 0.06);
-}
-
-.more-home-link {
- display: inline-flex;
- align-items: center;
- gap: 8px;
- margin-top: 24px;
- padding: 8px 16px;
- border-radius: 999px;
- background: rgba(255, 255, 255, 0.08);
- border: 1px solid rgba(255, 255, 255, 0.14);
- color: #e2e8f0;
- font-size: 14px;
- font-weight: 500;
- text-decoration: none;
- transition:
- background 0.2s ease,
- border-color 0.2s ease;
-}
-
-.more-home-link:hover {
- background: rgba(255, 255, 255, 0.16);
- border-color: rgba(255, 255, 255, 0.25);
-}
-
-.more-banner-title {
- font-size: 48px;
- font-weight: 700;
- letter-spacing: -1px;
- margin: 0 0 12px;
- color: #f1f5f9;
-}
-
-.more-banner-subtitle {
- font-size: 18px;
- margin: 0;
- color: #94a3b8;
-}
-
-.more-app-grid {
- display: grid;
- grid-template-columns: repeat(4, 1fr);
- gap: 20px;
-}
-
-.more-app-card {
- display: flex;
- align-items: center;
- gap: 16px;
- padding: 20px;
- border-radius: 16px;
- background: #1e293b;
- border: 1px solid rgba(255, 255, 255, 0.06);
- text-decoration: none;
- transition:
- transform 0.25s ease,
- box-shadow 0.25s ease,
- border-color 0.25s ease;
-}
-
-.more-app-card:hover {
- transform: translateY(-4px);
- border-color: rgba(255, 255, 255, 0.14);
- box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
-}
-
-.more-app-icon {
- flex-shrink: 0;
- display: inline-flex;
- align-items: center;
- justify-content: center;
- width: 48px;
- height: 48px;
- border-radius: 14px;
- color: #fff;
-}
-
-.more-app-icon svg {
- width: 22px;
- height: 22px;
-}
-
-.more-app-info {
- min-width: 0;
-}
-
-.more-app-name {
- font-size: 17px;
- font-weight: 600;
- margin: 0 0 4px;
- color: #f1f5f9;
-}
-
-.more-app-desc {
- font-size: 13px;
- margin: 0;
- color: #94a3b8;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
-}
-
-@media (max-width: 1024px) {
- .more-banner {
- padding: 64px 20px;
- }
-
- .more-app-grid {
- grid-template-columns: repeat(2, 1fr);
- }
-}
-
-@media (max-width: 600px) {
- .more-banner {
- padding: 48px 16px;
- margin-top: 16px;
- }
-
- .more-banner-title {
- font-size: 32px;
- }
-
- .more-app-grid {
- grid-template-columns: 1fr;
- }
-
- .more-app-desc {
- white-space: normal;
- }
-}
diff --git a/src/router/Link.tsx b/src/router/Link.tsx
new file mode 100644
index 0000000..dbdb066
--- /dev/null
+++ b/src/router/Link.tsx
@@ -0,0 +1,28 @@
+import type { AnchorHTMLAttributes, MouseEvent } from "react";
+import { navigate } from "./history";
+
+interface LinkProps extends AnchorHTMLAttributes
{
+ to: string;
+}
+
+// In-app link that routes client-side while keeping normal anchor semantics
+// (middle-click / modifier-click still open a new tab and get a real href).
+export function Link({ to, onClick, ...props }: LinkProps) {
+ function handleClick(event: MouseEvent) {
+ onClick?.(event);
+ if (
+ event.defaultPrevented ||
+ event.button !== 0 ||
+ event.metaKey ||
+ event.ctrlKey ||
+ event.shiftKey ||
+ event.altKey
+ ) {
+ return;
+ }
+ event.preventDefault();
+ navigate(to);
+ }
+
+ return ;
+}
diff --git a/src/router/history.ts b/src/router/history.ts
new file mode 100644
index 0000000..87d73a8
--- /dev/null
+++ b/src/router/history.ts
@@ -0,0 +1,36 @@
+// Minimal history-based routing primitives (no external router dependency).
+
+const listeners = new Set<() => void>();
+
+function notify() {
+ listeners.forEach((listener) => listener());
+}
+
+// Normalizes a pathname so "/more", "/more/" and "/more/index.html" all match.
+export function normalizePath(pathname: string): string {
+ let path = pathname.replace(/\/index\.html$/, "");
+ if (path.length > 1) path = path.replace(/\/+$/, "");
+ return path || "/";
+}
+
+// `useSyncExternalStore` subscribes here; `popstate` covers back/forward.
+export function subscribe(listener: () => void): () => void {
+ listeners.add(listener);
+ window.addEventListener("popstate", listener);
+ return () => {
+ listeners.delete(listener);
+ window.removeEventListener("popstate", listener);
+ };
+}
+
+export function getPath(): string {
+ return normalizePath(window.location.pathname);
+}
+
+// Client-side navigation. Same-path navigations are ignored.
+export function navigate(to: string): void {
+ const url = new URL(to, window.location.origin);
+ if (url.pathname === window.location.pathname) return;
+ window.history.pushState(null, "", url);
+ notify();
+}
diff --git a/src/router/index.ts b/src/router/index.ts
new file mode 100644
index 0000000..c6df115
--- /dev/null
+++ b/src/router/index.ts
@@ -0,0 +1,3 @@
+export { Link } from "./Link";
+export { useRoute } from "./useRoute";
+export { ROUTES, FALLBACK_ROUTE, matchRoute, type RouteDefinition } from "./routes";
diff --git a/src/router/routes.ts b/src/router/routes.ts
new file mode 100644
index 0000000..78bf3da
--- /dev/null
+++ b/src/router/routes.ts
@@ -0,0 +1,36 @@
+import type { ComponentType } from "react";
+import HomePage from "@/pages/HomePage";
+import MorePage from "@/pages/MorePage";
+
+export interface RouteDefinition {
+ name: string;
+ path: string;
+ pattern: RegExp;
+ title: string;
+ Component: ComponentType;
+}
+
+// Single source of truth for pages. Add a route here and it is wired up.
+export const ROUTES: RouteDefinition[] = [
+ {
+ name: "home",
+ path: "/",
+ pattern: /^\/$/,
+ title: "筱周の网站 - XiaoZhou's Website",
+ Component: HomePage,
+ },
+ {
+ name: "more",
+ path: "/more",
+ pattern: /^\/more$/,
+ title: "更多应用 - 筱周の网站",
+ Component: MorePage,
+ },
+];
+
+// Unknown paths fall back to home (preserves the previous behaviour).
+export const FALLBACK_ROUTE = ROUTES[0];
+
+export function matchRoute(pathname: string): RouteDefinition {
+ return ROUTES.find((route) => route.pattern.test(pathname)) ?? FALLBACK_ROUTE;
+}
diff --git a/src/router/useRoute.ts b/src/router/useRoute.ts
new file mode 100644
index 0000000..4e350f8
--- /dev/null
+++ b/src/router/useRoute.ts
@@ -0,0 +1,8 @@
+import { useSyncExternalStore } from "react";
+import { getPath, subscribe } from "./history";
+import { matchRoute, type RouteDefinition } from "./routes";
+
+export function useRoute(): { path: string; route: RouteDefinition } {
+ const path = useSyncExternalStore(subscribe, getPath, () => "/");
+ return { path, route: matchRoute(path) };
+}