refactor: 重构 TopBar 组件并更新项目结构

- 删除原有的 TopBar 组件,重构为布局组件并移动至 layout/ 目录。
- 更新相关文档,反映 TopBar 组件的新位置。
- 引入新的 useTopBar 钩子以管理 TopBar 的状态和逻辑。
- 添加 TopBar 组件的单元测试,确保功能正常。
This commit is contained in:
雨霖铃
2026-06-19 09:53:29 +08:00
parent a8a1e89f8a
commit 2c901ab4fd
10 changed files with 404 additions and 325 deletions
+22
View File
@@ -0,0 +1,22 @@
# layout/
应用壳层布局组件目录,存放与扩展入口(popup / sidepanel / tab)绑定的布局 UI,与 `components/` 中的通用可复用组件区分。
## 组件列表
| 目录 | 用途 |
| --------- | -------------------------------------------------------------- |
| `TopBar/` | 顶部导航栏:搜索(含历史记录)、主题切换、返回导航、标签页打开 |
## 目录结构
遵循与 `pages/` 相同的 UI + Hook 分离模式:
```
layout/TopBar/
├── index.tsx # 布局 UI
├── useTopBar.ts # 业务逻辑 Hook
├── constants.ts # 常量
└── __tests__/
└── index.test.tsx
```