From 61c1674e439dd791aee4fdc72e5738bbefed13e9 Mon Sep 17 00:00:00 2001 From: shu Date: Sun, 6 Sep 2026 19:13:10 +0800 Subject: 统一路由页面文件的 page 前缀与命名规范 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将首页、关于概览、关于我、表单和 UI Kit 页面改为 page- 前缀的小写横线文件名 - 同步重命名页面 CSS Modules,并更新组件样式引用 - 更新静态路由导入与懒加载路径,保持访问地址和页面行为不变 - 在代理约定中补充文件名称使用小写英文加横线的规范 验证:pnpm build、pnpm lint 和暂存区空白检查均通过。 --- src/About.tsx | 19 --- src/App.tsx | 12 -- src/FormExample.module.css | 3 - src/FormExample.tsx | 309 --------------------------------------------- src/Me.tsx | 10 -- src/UiKit.module.css | 14 -- src/UiKit.tsx | 294 ------------------------------------------ src/page-about-me.tsx | 10 ++ src/page-about.tsx | 19 +++ src/page-form.module.css | 3 + src/page-form.tsx | 309 +++++++++++++++++++++++++++++++++++++++++++++ src/page-home.tsx | 12 ++ src/page-ui-kit.module.css | 14 ++ src/page-ui-kit.tsx | 294 ++++++++++++++++++++++++++++++++++++++++++ src/routes.ts | 10 +- 15 files changed, 666 insertions(+), 666 deletions(-) delete mode 100644 src/About.tsx delete mode 100644 src/App.tsx delete mode 100644 src/FormExample.module.css delete mode 100644 src/FormExample.tsx delete mode 100644 src/Me.tsx delete mode 100644 src/UiKit.module.css delete mode 100644 src/UiKit.tsx create mode 100644 src/page-about-me.tsx create mode 100644 src/page-about.tsx create mode 100644 src/page-form.module.css create mode 100644 src/page-form.tsx create mode 100644 src/page-home.tsx create mode 100644 src/page-ui-kit.module.css create mode 100644 src/page-ui-kit.tsx (limited to 'src') diff --git a/src/About.tsx b/src/About.tsx deleted file mode 100644 index 21b4c1e..0000000 --- a/src/About.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { ActionIcon, Button, Group, Stack, Text, Title } from '@mantine/core' -import { SlidersHorizontalIcon } from '@phosphor-icons/react' - -function About() { - return ( - - 关于 - A React + TypeScript starter built with Vite. - - - - - - - - ) -} - -export default About diff --git a/src/App.tsx b/src/App.tsx deleted file mode 100644 index 8b213e6..0000000 --- a/src/App.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { Stack, Text, Title } from '@mantine/core' - -function App() { - return ( - - 欢迎使用 Template React - 从左侧菜单开始,探索你的应用。 - - ) -} - -export default App diff --git a/src/FormExample.module.css b/src/FormExample.module.css deleted file mode 100644 index 913f3f9..0000000 --- a/src/FormExample.module.css +++ /dev/null @@ -1,3 +0,0 @@ -.fileName { - overflow-wrap: anywhere; -} diff --git a/src/FormExample.tsx b/src/FormExample.tsx deleted file mode 100644 index 631bf53..0000000 --- a/src/FormExample.tsx +++ /dev/null @@ -1,309 +0,0 @@ -import { useState } from 'react' -import { - Alert, - Button, - Checkbox, - Cascader, - Code, - ColorInput, - Container, - FileInput, - Group, - MultiSelect, - NumberInput, - Paper, - PasswordInput, - Radio, - Select, - SimpleGrid, - Stack, - Switch, - TagsInput, - Text, - Textarea, - TextInput, - Title, - useMatches, -} from '@mantine/core' -import { isEmail, useForm } from '@mantine/form' -import { UploadSimpleIcon } from '@phosphor-icons/react' -import classes from './FormExample.module.css' - -// 仅用于演示联动,不是完整行政区划数据。 -const regions = [ - { - name: '浙江省', - cities: [ - { name: '杭州市', districts: ['西湖区', '拱墅区'] }, - { name: '宁波市', districts: ['海曙区', '鄞州区'] }, - ], - }, - { - name: '江苏省', - cities: [ - { name: '南京市', districts: ['鼓楼区', '玄武区'] }, - { name: '苏州市', districts: ['姑苏区', '吴中区'] }, - ], - }, -] - -const regionOptions = regions.map((province) => ({ - value: province.name, - children: province.cities.map((city) => ({ - value: city.name, - children: city.districts.map((district) => ({ value: district })), - })), -})) - -type FormValues = { - name: string - email: string - role: string | null - region: string[] | null - contact: string - interests: string[] - technologies: string[] - tags: string[] - color: string - files: File[] - quantity: number | string - password: string - description: string - notifications: boolean - acceptedTerms: boolean -} - -const exampleErrors = { email: '邮箱格式不正确,例如 name@example.com' } - -export default function FormExample() { - const [submitted, setSubmitted] = useState(null) - const withColumns = useMatches({ base: false, sm: true }) - const form = useForm({ - mode: 'controlled', - validateInputOnBlur: true, - initialErrors: exampleErrors, - initialValues: { - name: '', - email: 'invalid-email', - role: null, - region: null, - contact: 'email', - interests: [], - technologies: [], - tags: [], - color: '#228be6', - files: [], - quantity: 1, - password: '', - description: '', - notifications: false, - acceptedTerms: false, - }, - validate: { - name: (value) => value.trim() ? null : '请输入名称', - email: (value) => !value.trim() ? '请输入邮箱' : isEmail(exampleErrors.email)(value.trim()), - role: (value) => value ? null : '请选择角色', - quantity: (value) => typeof value === 'number' && Number.isInteger(value) && value >= 0 && value <= 100 - ? null : '请输入 0–100 之间的整数', - password: (value) => value && value.length < 8 ? '密码至少需要 8 位' : null, - color: (value) => /^#[\da-f]{6}$/i.test(value) ? null : '请输入有效的六位 HEX 颜色', - acceptedTerms: (value) => value ? null : '请先阅读并同意示例协议', - }, - }) - - function submit(values: FormValues) { - setSubmitted(JSON.stringify({ - ...values, - password: values.password ? '已填写(不展示密码)' : '未填写', - files: values.files.map((file) => ({ - name: file.name, - size: file.size, - type: file.type || '未知类型', - })), - }, null, 2)) - } - - return ( - - -
- 表单示例 - 体验常用表单控件。提交后在本页预览结果,数据和文件不会发送到服务器。 -
- - -
setSubmitted(null))} - onReset={(event) => { - event.preventDefault() - form.reset() - form.setErrors(exampleErrors) - setSubmitted(null) - }} - noValidate - > - - 带 * 的项目为必填项;离开输入框或提交时会校验。邮箱预填了错误值,用于演示错误提示。 - - - -