Skip to content
This repository was archived by the owner on May 29, 2026. It is now read-only.

Commit 20eea4e

Browse files
committed
refactor: update layout components for consistency and clarity
- Removed unnecessary background classes from various layout components to streamline styling. - Adjusted default background colors in the MasterDetailLayout component for better visual consistency. - Cleaned up class attributes in multiple components to enhance readability and maintainability. These changes aim to improve the overall layout structure and ensure a more uniform appearance across the application. Signed-off-by: Innei <tukon479@gmail.com>
1 parent d2698e2 commit 20eea4e

15 files changed

Lines changed: 44 additions & 56 deletions

File tree

docs/master-detail-layout.md

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
```
88
┌─────────────────────────────────────────────────────────────┐
99
│ Header (h-16) │
10-
│ border-b border-neutral-100 dark:border-neutral-900 │
1110
├───────────────────┬─────────────────────────────────────────┤
1211
│ │ │
1312
│ List Panel │ Detail Panel │
@@ -49,14 +48,14 @@ const { isMobile } = useMasterDetailLayout()
4948

5049
### Props
5150

52-
| Prop | 类型 | 默认值 | 说明 |
53-
|------|------|--------|------|
54-
| `showDetailOnMobile` | `boolean` | `false` | 移动端是否显示详情面板 |
55-
| `defaultSize` | `number` | `0.3` | 列表面板默认宽度比例 |
56-
| `min` | `number` | `0.2` | 最小宽度比例 |
57-
| `max` | `number` | `0.4` | 最大宽度比例 |
58-
| `listBgClass` | `string` | `'bg-white dark:bg-neutral-900'` | 列表面板背景 |
59-
| `detailBgClass` | `string` | `'bg-neutral-50 dark:bg-neutral-950'` | 详情面板背景 |
51+
| Prop | 类型 | 默认值 | 说明 |
52+
| -------------------- | --------- | ------------------------------------- | ---------------------- |
53+
| `showDetailOnMobile` | `boolean` | `false` | 移动端是否显示详情面板 |
54+
| `defaultSize` | `number` | `0.3` | 列表面板默认宽度比例 |
55+
| `min` | `number` | `0.2` | 最小宽度比例 |
56+
| `max` | `number` | `0.4` | 最大宽度比例 |
57+
| `listBgClass` | `string` | `'bg-white dark:bg-neutral-900'` | 列表面板背景 |
58+
| `detailBgClass` | `string` | `'bg-neutral-50 dark:bg-neutral-950'` | 详情面板背景 |
6059

6160
### Slots
6261

@@ -176,7 +175,7 @@ const { isMobile } = useMasterDetailLayout()
176175

177176
```tsx
178177
// 容器
179-
<div class="flex h-full flex-col bg-white dark:bg-black">
178+
<div class="flex h-full flex-col">
180179

181180
// 头部
182181
<div class="flex h-12 flex-shrink-0 items-center justify-between border-b border-neutral-200 px-4 dark:border-neutral-800">
@@ -254,15 +253,11 @@ class="hover:bg-red-50 hover:text-red-600 dark:hover:bg-red-900/20 dark:hover:te
254253
<div class="group flex items-center justify-between border-b border-neutral-100 px-0 py-2.5 transition-colors last:border-b-0 hover:bg-neutral-50 dark:border-neutral-800/50 dark:hover:bg-neutral-800/30">
255254
<div class="min-w-0 flex-1">
256255
<div class="flex items-center gap-2">
257-
<span class="shrink-0 font-mono text-xs text-neutral-400">
258-
#123
259-
</span>
256+
<span class="shrink-0 font-mono text-xs text-neutral-400">#123</span>
260257
<span class="truncate text-sm text-neutral-900 dark:text-neutral-100">
261258
标题
262259
</span>
263-
<span class="shrink-0 text-xs text-neutral-400">
264-
时间
265-
</span>
260+
<span class="shrink-0 text-xs text-neutral-400">时间</span>
266261
</div>
267262
</div>
268263
<div class="flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100">
@@ -275,28 +270,30 @@ class="hover:bg-red-50 hover:text-red-600 dark:hover:bg-red-900/20 dark:hover:te
275270

276271
## 颜色规范
277272

278-
| 用途 | Light | Dark |
279-
|------|-------|------|
280-
| 列表面板背景 | `bg-white` | `dark:bg-neutral-900` |
281-
| 详情面板背景 | `bg-neutral-50` | `dark:bg-neutral-950` |
282-
| 边框 | `border-neutral-200` | `dark:border-neutral-800` |
283-
| 次要边框 | `border-neutral-100` | `dark:border-neutral-800/50` |
284-
| 选中项背景 | `bg-neutral-100` | `dark:bg-neutral-800` |
285-
| 悬停背景 | `hover:bg-neutral-50` | `dark:hover:bg-neutral-800/30` |
286-
| 主要文字 | `text-neutral-900` | `dark:text-neutral-100` |
287-
| 次要文字 | `text-neutral-500` | `dark:text-neutral-400` |
288-
| 辅助文字 | `text-neutral-400` | `dark:text-neutral-500` |
273+
| 用途 | Light | Dark |
274+
| ------------ | --------------------- | ------------------------------ |
275+
| 列表面板背景 | `bg-white` | `dark:bg-neutral-900` |
276+
| 详情面板背景 | `bg-neutral-50` | `dark:bg-neutral-950` |
277+
| 边框 | `border-neutral-200` | `dark:border-neutral-800` |
278+
| 次要边框 | `border-neutral-100` | `dark:border-neutral-800/50` |
279+
| 选中项背景 | `bg-neutral-100` | `dark:bg-neutral-800` |
280+
| 悬停背景 | `hover:bg-neutral-50` | `dark:hover:bg-neutral-800/30` |
281+
| 主要文字 | `text-neutral-900` | `dark:text-neutral-100` |
282+
| 次要文字 | `text-neutral-500` | `dark:text-neutral-400` |
283+
| 辅助文字 | `text-neutral-400` | `dark:text-neutral-500` |
289284

290285
---
291286

292287
## 响应式行为
293288

294289
### Desktop (≥1024px)
290+
295291
- 使用 `NSplit` 分栏布局
296292
- 列表和详情同时显示
297293
- 可拖拽调整比例
298294

299295
### Mobile/Tablet (<1024px)
296+
300297
- 全屏切换模式
301298
- 默认显示列表
302299
- 选中项目后滑动切换到详情

src/components/draft/diff-preview.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,7 @@ export const DiffPreview = defineComponent({
109109
})
110110

111111
return () => (
112-
<div
113-
ref={containerRef}
114-
class="h-full overflow-auto rounded-lg bg-neutral-50 dark:bg-neutral-900"
115-
>
112+
<div ref={containerRef} class="h-full overflow-auto rounded-lg">
116113
{isLoading.value && (
117114
<div class="flex h-full items-center justify-center text-neutral-400">
118115
加载中...

src/components/draft/file-preview.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,7 @@ export const FilePreview = defineComponent({
9999
})
100100

101101
return () => (
102-
<div
103-
ref={containerRef}
104-
class="h-full overflow-auto bg-neutral-50 dark:bg-neutral-900"
105-
>
102+
<div ref={containerRef} class="h-full overflow-auto">
106103
{isLoading.value && (
107104
<div class="flex h-full items-center justify-center text-neutral-400">
108105
加载中...

src/components/layout/master-detail-layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const MasterDetailLayout = defineComponent({
4141
},
4242
detailBgClass: {
4343
type: String,
44-
default: 'bg-neutral-50 dark:bg-neutral-950',
44+
default: 'bg-white dark:bg-neutral-900',
4545
},
4646
onMobileBack: {
4747
type: Function as PropType<() => void>,
@@ -60,7 +60,7 @@ export const MasterDetailLayout = defineComponent({
6060
layout.contentPadding.value = false
6161
layout.contentMinFullHeight.value = true
6262
setHeaderClass(
63-
'md:px-4 border-b border-neutral-100 dark:border-neutral-900',
63+
'md:px-4 border-b border-neutral-200 dark:border-neutral-800',
6464
)
6565
})
6666

src/components/layout/split-panel-layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export const SplitPanelLayout = defineComponent({
9393
>
9494
{{
9595
1: () => (
96-
<div class="h-full overflow-hidden border-r border-neutral-200 bg-white dark:border-neutral-800 dark:bg-black">
96+
<div class="h-full overflow-hidden border-r border-neutral-200 dark:border-neutral-800">
9797
{slots.list?.()}
9898
</div>
9999
),

src/layouts/settings-layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const SettingsDetailPanel = defineComponent({
1818
const { isMobile } = useMasterDetailLayout()
1919

2020
return () => (
21-
<div class="flex h-full flex-col bg-white dark:bg-black">
21+
<div class="flex h-full flex-col">
2222
{/* Header */}
2323
<div class="flex h-12 flex-shrink-0 items-center justify-between border-b border-neutral-200 px-4 dark:border-neutral-800">
2424
<div class="flex items-center gap-3">

src/views/ai/tasks.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ const TaskDetailPanel = defineComponent({
866866
/>
867867
) : null,
868868
empty: () => (
869-
<div class="flex h-full flex-col items-center justify-center bg-neutral-50 dark:bg-neutral-900">
869+
<div class="flex h-full flex-col items-center justify-center">
870870
<ListTodoIcon
871871
class="mb-2 size-8 text-neutral-300 dark:text-neutral-600"
872872
aria-hidden="true"

src/views/comments/components/comment-detail.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export const CommentDetail = defineComponent({
203203
)
204204

205205
return () => (
206-
<div class="flex h-full flex-col bg-white dark:bg-black">
206+
<div class="flex h-full flex-col">
207207
<div class="flex h-12 flex-shrink-0 items-center justify-between border-b border-neutral-200 px-4 dark:border-neutral-800">
208208
<div class="flex items-center gap-3">
209209
{props.isMobile && props.onBack && (
@@ -436,9 +436,9 @@ export const CommentDetail = defineComponent({
436436
</NScrollbar>
437437

438438
{!isTrash.value && (
439-
<div class="flex-shrink-0 border-t border-neutral-200 bg-white p-4 dark:border-neutral-800 dark:bg-black">
439+
<div class="flex-shrink-0 border-t border-neutral-200 bg-white p-4 dark:border-neutral-800 dark:bg-neutral-900">
440440
<div class="mx-auto max-w-3xl">
441-
<div class="relative overflow-hidden rounded-lg border border-neutral-200 bg-white shadow-sm focus-within:border-neutral-400 focus-within:ring-1 focus-within:ring-neutral-400 dark:border-neutral-800 dark:bg-black dark:focus-within:border-neutral-700 dark:focus-within:ring-neutral-700">
441+
<div class="relative overflow-hidden rounded-lg border border-neutral-200 bg-white shadow-sm focus-within:border-neutral-400 focus-within:ring-1 focus-within:ring-neutral-400 dark:border-neutral-800 dark:bg-neutral-900 dark:focus-within:border-neutral-700 dark:focus-within:ring-neutral-700">
442442
<NInput
443443
ref={replyInputRef}
444444
value={replyText.value}
@@ -493,11 +493,10 @@ export const CommentDetail = defineComponent({
493493
<NButton
494494
type="primary"
495495
size="tiny"
496-
color="black"
497496
onClick={handleReplySubmit}
498497
loading={props.replyLoading}
499498
disabled={!replyText.value.trim()}
500-
class="px-4"
499+
class="px-2"
501500
>
502501
发送回复
503502
</NButton>

src/views/drafts/components/draft-detail.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ export const DraftDetail = defineComponent({
481481
<NSpin />
482482
</div>
483483
) : diffStats.value?.isSame ? (
484-
<div class="flex h-full flex-col items-center justify-center gap-3 bg-white p-4 dark:bg-neutral-900">
484+
<div class="flex h-full flex-col items-center justify-center gap-3 p-4">
485485
<div class="flex size-12 items-center justify-center rounded-full bg-neutral-100 dark:bg-neutral-800">
486486
<GitCompare class="size-6 text-neutral-500 dark:text-neutral-400" />
487487
</div>
@@ -593,7 +593,7 @@ export const DraftDetail = defineComponent({
593593
</p>
594594
</div>
595595
) : diffStats.value?.isSame ? (
596-
<div class="flex h-full flex-col items-center justify-center gap-3 rounded-lg border border-dashed border-neutral-300 bg-white dark:border-neutral-700 dark:bg-neutral-900">
596+
<div class="flex h-full flex-col items-center justify-center gap-3">
597597
<div class="flex size-12 items-center justify-center rounded-full bg-neutral-100 dark:bg-neutral-800">
598598
<GitCompare class="size-6 text-neutral-500 dark:text-neutral-400" />
599599
</div>

src/views/extra-features/snippets/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export default defineComponent({
186186
)
187187

188188
const DetailPanel = () => (
189-
<div class="flex h-full flex-col bg-white dark:bg-black">
189+
<div class="flex h-full flex-col">
190190
{/* Header */}
191191
<div class="flex h-12 flex-shrink-0 items-center justify-between border-b border-neutral-200 px-4 dark:border-neutral-800">
192192
<div class="flex items-center gap-3">

0 commit comments

Comments
 (0)