refactor: 重构路由、统一 MorePage 样式并清理冗余
- 新增零依赖路由器 (src/router):路由表 + useSyncExternalStore hook + Link 组件 - 抽出 HomePage,document.title 改由路由表驱动 - MorePage 改用 Tailwind 并复用 Header/Footer,移除 more.css - 清理未使用依赖 (clsx/tailwind-merge/cva/tw-animate-css)、utils.ts、空 icons 目录、未用的 shadcn 主题变量及重复背景图
This commit is contained in:
1 parent
4f687ba457
commit
9ce0c5704a
16 files changed
+221
-393
No files matched your search
Generated
+1
-45
@@ -10,14 +10,10 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fontsource-variable/geist": "^5.2.9",
|
"@fontsource-variable/geist": "^5.2.9",
|
||||||
"@tailwindcss/vite": "^4.3.0",
|
"@tailwindcss/vite": "^4.3.0",
|
||||||
"class-variance-authority": "^0.7.1",
|
|
||||||
"clsx": "^2.1.1",
|
|
||||||
"lucide-react": "^1.17.0",
|
"lucide-react": "^1.17.0",
|
||||||
"react": "^19.2.6",
|
"react": "^19.2.6",
|
||||||
"react-dom": "^19.2.6",
|
"react-dom": "^19.2.6",
|
||||||
"tailwind-merge": "^3.6.0",
|
"tailwindcss": "^4.3.0"
|
||||||
"tailwindcss": "^4.3.0",
|
|
||||||
"tw-animate-css": "^1.4.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^10.0.1",
|
"@eslint/js": "^10.0.1",
|
||||||
@@ -1562,27 +1558,6 @@
|
|||||||
],
|
],
|
||||||
"license": "CC-BY-4.0"
|
"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": {
|
"node_modules/convert-source-map": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
|
||||||
@@ -2759,16 +2734,6 @@
|
|||||||
"node": ">=0.10.0"
|
"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": {
|
"node_modules/tailwindcss": {
|
||||||
"version": "4.3.0",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.3.0.tgz",
|
||||||
@@ -2824,15 +2789,6 @@
|
|||||||
"license": "0BSD",
|
"license": "0BSD",
|
||||||
"optional": true
|
"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": {
|
"node_modules/type-check": {
|
||||||
"version": "0.4.0",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
|
||||||
|
|||||||
+1
-5
@@ -12,14 +12,10 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fontsource-variable/geist": "^5.2.9",
|
"@fontsource-variable/geist": "^5.2.9",
|
||||||
"@tailwindcss/vite": "^4.3.0",
|
"@tailwindcss/vite": "^4.3.0",
|
||||||
"class-variance-authority": "^0.7.1",
|
|
||||||
"clsx": "^2.1.1",
|
|
||||||
"lucide-react": "^1.17.0",
|
"lucide-react": "^1.17.0",
|
||||||
"react": "^19.2.6",
|
"react": "^19.2.6",
|
||||||
"react-dom": "^19.2.6",
|
"react-dom": "^19.2.6",
|
||||||
"tailwind-merge": "^3.6.0",
|
"tailwindcss": "^4.3.0"
|
||||||
"tailwindcss": "^4.3.0",
|
|
||||||
"tw-animate-css": "^1.4.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^10.0.1",
|
"@eslint/js": "^10.0.1",
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 133 KiB |
+9
-17
@@ -1,22 +1,14 @@
|
|||||||
import Banner from "./components/Banner";
|
import { useEffect } from "react";
|
||||||
import AboutSection from "./components/sections/AboutSection";
|
import { useRoute } from "@/router";
|
||||||
import ProjectsSection from "./components/sections/ProjectsSection";
|
|
||||||
import ContactSection from "./components/sections/ContactSection";
|
|
||||||
import MorePage from "./pages/MorePage";
|
|
||||||
|
|
||||||
|
// Resolves the current path to a page via the route registry.
|
||||||
export default function App() {
|
export default function App() {
|
||||||
const { pathname } = window.location;
|
const { route } = useRoute();
|
||||||
|
|
||||||
if (/^\/more(\/index\.html)?\/?$/.test(pathname)) {
|
useEffect(() => {
|
||||||
return <MorePage />;
|
document.title = route.title;
|
||||||
}
|
}, [route.title]);
|
||||||
|
|
||||||
return (
|
const { Component } = route;
|
||||||
<div className="bg-black">
|
return <Component />;
|
||||||
<Banner />
|
|
||||||
<AboutSection />
|
|
||||||
<ProjectsSection />
|
|
||||||
<ContactSection />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
@@ -1,20 +1,19 @@
|
|||||||
|
import { Link } from "@/router";
|
||||||
import type { NavItem } from "@/types";
|
import type { NavItem } from "@/types";
|
||||||
|
|
||||||
interface NavCardProps {
|
interface NavCardProps {
|
||||||
item: NavItem;
|
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) {
|
export default function NavCard({ item }: NavCardProps) {
|
||||||
const { name, desc, path, Icon, color, borderHover } = item;
|
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`;
|
||||||
<a
|
|
||||||
href={path}
|
const content = (
|
||||||
target="_blank"
|
<>
|
||||||
rel="noopener noreferrer"
|
|
||||||
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 block`}
|
|
||||||
>
|
|
||||||
<div className="shrink-0 transition-transform duration-300 group-hover:scale-105">
|
<div className="shrink-0 transition-transform duration-300 group-hover:scale-105">
|
||||||
<Icon className={color} size={36} />
|
<Icon className={color} size={36} />
|
||||||
</div>
|
</div>
|
||||||
@@ -26,6 +25,20 @@ export default function NavCard({ item }: NavCardProps) {
|
|||||||
{desc}
|
{desc}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
|
if (path.startsWith("/")) {
|
||||||
|
return (
|
||||||
|
<Link to={path} className={className}>
|
||||||
|
{content}
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<a href={path} target="_blank" rel="noopener noreferrer" className={className}>
|
||||||
|
{content}
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
import { LayoutDashboard, ListCollapse } from "lucide-react";
|
import { LayoutDashboard, ListCollapse } from "lucide-react";
|
||||||
// GitFork, MonitorCog, Workflow
|
|
||||||
import type { NavItem } from "@/types";
|
import type { NavItem } from "@/types";
|
||||||
|
|
||||||
// External links displayed as navigation cards on the banner
|
// External links displayed as navigation cards on the banner
|
||||||
|
|||||||
+7
-120
@@ -1,129 +1,16 @@
|
|||||||
@import "tailwindcss";
|
@import "tailwindcss";
|
||||||
@import "tw-animate-css";
|
|
||||||
@import "@fontsource-variable/geist";
|
@import "@fontsource-variable/geist";
|
||||||
|
|
||||||
@custom-variant dark (&:is(.dark *));
|
@theme {
|
||||||
|
--font-sans: "Geist Variable", system-ui, sans-serif;
|
||||||
@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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@layer base {
|
@layer base {
|
||||||
* {
|
|
||||||
@apply border-border outline-ring/50;
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
@apply bg-background text-foreground;
|
|
||||||
}
|
|
||||||
html {
|
html {
|
||||||
@apply font-sans;
|
font-family: var(--font-sans);
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
@apply bg-black text-white antialiased;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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))
|
|
||||||
}
|
|
||||||
@@ -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 (
|
||||||
|
<div className="bg-black">
|
||||||
|
<Banner />
|
||||||
|
<AboutSection />
|
||||||
|
<ProjectsSection />
|
||||||
|
<ContactSection />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
+55
-23
@@ -1,5 +1,7 @@
|
|||||||
import { useEffect } from "react";
|
import { Link } from "@/router";
|
||||||
import "./more.css";
|
import Header from "@/components/layout/Header";
|
||||||
|
import Footer from "@/components/layout/Footer";
|
||||||
|
import bannerImg from "@/assets/banner.png";
|
||||||
|
|
||||||
const appIcons = {
|
const appIcons = {
|
||||||
water: <path d="M12 2.69l5.66 5.66a8 8 0 1 1-11.31 0z" />,
|
water: <path d="M12 2.69l5.66 5.66a8 8 0 1 1-11.31 0z" />,
|
||||||
@@ -17,31 +19,55 @@ const apps = [
|
|||||||
{ name: "力的课题", desc: "认识三种基本的力", color: "#ef4444", link: "/forces.html", icon: appIcons.atom },
|
{ 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() {
|
export default function MorePage() {
|
||||||
useEffect(() => {
|
|
||||||
document.title = "更多应用";
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="more-page">
|
<div
|
||||||
<div className="more-page-inner">
|
className="relative w-full min-h-screen flex flex-col text-white overflow-hidden font-mono"
|
||||||
<header className="more-banner">
|
style={{
|
||||||
<h1 className="more-banner-title">更多应用</h1>
|
backgroundImage: `url(${bannerImg})`,
|
||||||
<p className="more-banner-subtitle">一个入口,汇聚所有工具</p>
|
backgroundSize: "cover",
|
||||||
<a className="more-home-link" href="/">
|
backgroundPosition: "center",
|
||||||
返回主站
|
}}
|
||||||
</a>
|
>
|
||||||
</header>
|
<div className="absolute inset-0 bg-black/80 pointer-events-none" />
|
||||||
|
|
||||||
<main className="more-app-grid">
|
<Header />
|
||||||
|
|
||||||
|
<main className="relative z-10 flex-1 w-full max-w-5xl mx-auto px-4 py-16 md:py-24">
|
||||||
|
<div className="text-center mb-14">
|
||||||
|
<h1 className="text-4xl md:text-6xl font-extrabold tracking-tighter text-transparent bg-clip-text bg-linear-to-r from-emerald-50 via-white to-emerald-50 drop-shadow-[0_0_15px_rgba(52,211,153,0.4)]">
|
||||||
|
更多应用
|
||||||
|
</h1>
|
||||||
|
<p className="mt-5 text-emerald-400/80 text-sm md:text-base tracking-tight font-light">
|
||||||
|
{"< 一个入口,汇聚所有工具 >"}
|
||||||
|
</p>
|
||||||
|
<div className="w-12 h-0.5 bg-emerald-500 mt-5 mx-auto shadow-[0_0_8px_#10b981]" />
|
||||||
|
<Link
|
||||||
|
to="/"
|
||||||
|
className="inline-flex items-center mt-8 px-4 py-2 rounded-full bg-white/5 border border-white/10 text-sm text-gray-200 transition-colors hover:bg-white/10 hover:border-emerald-500/40 hover:text-white"
|
||||||
|
>
|
||||||
|
返回主站
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||||
{apps.map((app) => (
|
{apps.map((app) => (
|
||||||
<a key={app.name} className="more-app-card" href={app.link}>
|
<a
|
||||||
|
key={app.name}
|
||||||
|
href={app.link}
|
||||||
|
className="flex items-center gap-5 p-6 rounded-2xl bg-white/5 border border-white/5 backdrop-blur-sm transition-all duration-300 hover:-translate-y-1 hover:bg-white/10 hover:border-emerald-500/30 hover:shadow-[0_0_25px_rgba(52,211,153,0.1)] group"
|
||||||
|
>
|
||||||
<span
|
<span
|
||||||
className="more-app-icon"
|
className="shrink-0 flex items-center justify-center w-12 h-12 rounded-xl text-white transition-transform duration-300 group-hover:scale-105"
|
||||||
style={{ background: `linear-gradient(135deg, ${app.color}, ${app.color}cc)` }}
|
style={{
|
||||||
|
background: `linear-gradient(135deg, ${app.color}, ${app.color}cc)`,
|
||||||
|
boxShadow: `0 0 18px ${app.color}40`,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
|
className="w-6 h-6"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
strokeWidth="2"
|
strokeWidth="2"
|
||||||
@@ -52,14 +78,20 @@ export default function MorePage() {
|
|||||||
{app.icon}
|
{app.icon}
|
||||||
</svg>
|
</svg>
|
||||||
</span>
|
</span>
|
||||||
<div className="more-app-info">
|
<div className="min-w-0">
|
||||||
<h2 className="more-app-name">{app.name}</h2>
|
<h2 className="text-lg font-bold text-gray-100 transition-colors group-hover:text-white">
|
||||||
<p className="more-app-desc">{app.desc}</p>
|
{app.name}
|
||||||
|
</h2>
|
||||||
|
<p className="text-sm text-gray-400/80 mt-1 tracking-wide font-sans transition-colors group-hover:text-gray-300">
|
||||||
|
{app.desc}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
))}
|
))}
|
||||||
</main>
|
|
||||||
</div>
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<Footer />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import type { AnchorHTMLAttributes, MouseEvent } from "react";
|
||||||
|
import { navigate } from "./history";
|
||||||
|
|
||||||
|
interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
||||||
|
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<HTMLAnchorElement>) {
|
||||||
|
onClick?.(event);
|
||||||
|
if (
|
||||||
|
event.defaultPrevented ||
|
||||||
|
event.button !== 0 ||
|
||||||
|
event.metaKey ||
|
||||||
|
event.ctrlKey ||
|
||||||
|
event.shiftKey ||
|
||||||
|
event.altKey
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
navigate(to);
|
||||||
|
}
|
||||||
|
|
||||||
|
return <a href={to} onClick={handleClick} {...props} />;
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export { Link } from "./Link";
|
||||||
|
export { useRoute } from "./useRoute";
|
||||||
|
export { ROUTES, FALLBACK_ROUTE, matchRoute, type RouteDefinition } from "./routes";
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -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) };
|
||||||
|
}
|
||||||
Reference in new issue
Block a user