refactor: 移除 TopBar 组件,重构功能导航并引入主题切换按钮

- 删除 TopBar 及其相关组件和逻辑,简化布局结构。
- 新增 FeatureNav 组件,包含功能导航和主题切换按钮。
- 更新 README.md,反映新的组件结构和功能。
- 修改测试用例,确保新结构下的功能正常。
This commit is contained in:
2026-07-05 22:30:13 +08:00
parent 43038c5edb
commit b487f71512
17 changed files with 115 additions and 541 deletions
+9 -11
View File
@@ -4,23 +4,21 @@
## 组件列表
| 目录 | 用途 |
| --------- | -------------------------------------------------------------- |
| `TopBar/` | 顶部导航栏:搜索(含历史记录)、主题切换、返回导航、标签页打开 |
| 目录 | 用途 |
| ------------- | ------------------------------------------ |
| `FeatureNav/` | 右侧功能导航栏:工具图标切换、底部主题切换 |
## 目录结构
遵循与 `pages/` 相同的 UI + Hook 分离模式:
```
layout/TopBar/
├── index.tsx # 布局入口
├── useTopBar.ts # 业务逻辑 Hook
├── constants.ts # 常量
├── SearchInput.tsx # 搜索输入框
├── SearchDropdown.tsx # 搜索结果/历史下拉面板
├── SearchResultItem.tsx # 单条搜索结果项
├── TopBarActions.tsx # 右侧操作按钮组
layout/FeatureNav/
├── index.tsx # 垂直图标导航 + 底部主题按钮
├── useFeatureNav.ts # 读路由状态,暴露 navItems / navigateTo
├── useThemeToggle.ts # 主题模式循环切换逻辑
├── ThemeToggleButton.tsx # 主题切换按钮
├── resolveNavFeatures.ts # 功能列表解析
└── __tests__/
└── index.test.tsx
```