From 2f1057a9d9d51d0e657c1203d3781173e8efc611 Mon Sep 17 00:00:00 2001 From: shu Date: Sun, 6 Sep 2026 17:04:49 +0800 Subject: 初始化 React TypeScript 模板并实现 Mantine 响应式基础布局 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 使用 Vite、React 和 TypeScript 初始化项目,配置 pnpm、Oxlint 与 Mantine PostCSS - 接入 React Router Data Mode,将页面路由、菜单标题和图标统一维护在路由配置中 - 添加首页、关于概览与关于我页面,使用 Nested NavLinks 根据路由生成多级菜单 - 实现桌面侧栏展开和图标模式、移动端全宽抽屉以及与品牌区对齐的顶栏 - 将布局自定义样式拆分为 CSS Modules,统一 xs 间距并固定菜单图标列位置 - 添加文档流页脚,展示自动更新年份的示例版权说明 - 配置 Mantine 默认圆角、项目说明及中文提交约定 验证:pnpm build、pnpm lint、git diff --cached --check 均通过。 --- src/routes.ts | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/routes.ts (limited to 'src/routes.ts') diff --git a/src/routes.ts b/src/routes.ts new file mode 100644 index 0000000..83f97b6 --- /dev/null +++ b/src/routes.ts @@ -0,0 +1,39 @@ +import { HouseIcon, InfoIcon, UserIcon } from '@phosphor-icons/react' +import type { Icon } from '@phosphor-icons/react' +import type { RouteObject } from 'react-router' +import App from './App.tsx' +import About from './About.tsx' +import Me from './Me.tsx' + +export type PageRoute = RouteObject & { + handle?: { title: string; icon: Icon } + children?: PageRoute[] +} + +export const pageRoutes = [ + { + id: 'home', + index: true, + Component: App, + handle: { title: '首页', icon: HouseIcon }, + }, + { + id: 'about', + path: '/about', + handle: { title: '关于', icon: InfoIcon }, + children: [ + { + id: 'about-index', + index: true, + Component: About, + handle: { title: '关于概览', icon: InfoIcon }, + }, + { + id: 'about-me', + path: 'me', + Component: Me, + handle: { title: '关于我', icon: UserIcon }, + }, + ], + }, +] satisfies PageRoute[] -- cgit v1.2.3