Skip to content

Commit dfc3a63

Browse files
committed
feat: 美化滚动条
1 parent 3410a84 commit dfc3a63

File tree

2 files changed

+62
-26
lines changed

2 files changed

+62
-26
lines changed

src/components/setting/EnvironmentManager.vue

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,30 @@
4242
</div>
4343
</div>
4444

45+
<!-- 下载进度 -->
46+
<div v-if="isDownloading && downloadProgress" class="p-2 bg-blue-50 dark:bg-blue-900/20 rounded-lg space-y-2">
47+
<div class="flex items-center justify-between">
48+
<div class="flex items-center space-x-2">
49+
<svg class="animate-spin h-4 w-4 text-blue-600 dark:text-blue-400" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
50+
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
51+
<path class="opacity-75" fill="currentColor"
52+
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
53+
</svg>
54+
<span class="text-sm font-medium text-blue-900 dark:text-blue-100">
55+
{{ downloadStatusText }}
56+
</span>
57+
</div>
58+
<span class="text-sm font-semibold text-blue-600 dark:text-blue-400">
59+
{{ downloadProgress.percentage.toFixed(1) }}%
60+
</span>
61+
</div>
62+
<div class="w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2">
63+
<div class="bg-blue-600 dark:bg-blue-400 h-2 rounded-full transition-all duration-300"
64+
:style="{ width: `${downloadProgress.percentage}%` }">
65+
</div>
66+
</div>
67+
</div>
68+
4569
<!-- 获取可用版本错误信息 -->
4670
<div v-if="environmentInfo?.error" class="p-3 bg-yellow-50 dark:bg-yellow-900/20 rounded-lg">
4771
<div class="flex items-center space-x-2 text-yellow-600 dark:text-yellow-400">
@@ -56,7 +80,7 @@
5680
<!-- 已安装版本 -->
5781
<template #installed>
5882
<div v-if="environmentInfo.installed_versions.length > 0" class="space-y-2">
59-
<div :class="environmentInfo.error ? 'max-h-76' : 'max-h-92'"
83+
<div :class="environmentInfo.error || error ? 'max-h-76' : 'max-h-92'"
6084
class="space-y-2 overflow-y-auto pr-1 scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-gray-600 scrollbar-track-transparent">
6185
<div v-for="version in environmentInfo.installed_versions"
6286
:key="version.version"
@@ -86,31 +110,7 @@
86110
<!-- 可用版本 -->
87111
<template #available>
88112
<div class="space-y-2">
89-
<!-- 下载进度 -->
90-
<div v-if="isDownloading && downloadProgress" class="p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg space-y-2">
91-
<div class="flex items-center justify-between">
92-
<div class="flex items-center space-x-2">
93-
<svg class="animate-spin h-4 w-4 text-blue-600 dark:text-blue-400" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
94-
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
95-
<path class="opacity-75" fill="currentColor"
96-
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
97-
</svg>
98-
<span class="text-sm font-medium text-blue-900 dark:text-blue-100">
99-
{{ downloadStatusText }}
100-
</span>
101-
</div>
102-
<span class="text-sm font-semibold text-blue-600 dark:text-blue-400">
103-
{{ downloadProgress.percentage.toFixed(1) }}%
104-
</span>
105-
</div>
106-
<div class="w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2">
107-
<div class="bg-blue-600 dark:bg-blue-400 h-2 rounded-full transition-all duration-300"
108-
:style="{ width: `${downloadProgress.percentage}%` }">
109-
</div>
110-
</div>
111-
</div>
112-
113-
<div :class="environmentInfo.error ? 'max-h-76' : 'max-h-92'"
113+
<div :class="environmentInfo.error || error ? 'max-h-76' : 'max-h-92'"
114114
class="space-y-2 overflow-y-auto pr-1 scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-gray-600 scrollbar-track-transparent">
115115
<div v-for="version in availableVersionsToShow"
116116
:key="version.version"

src/style.css

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,42 @@
44
body {
55
@apply bg-gray-50 text-gray-900;
66
}
7+
8+
::-webkit-scrollbar {
9+
width: 8px;
10+
height: 8px;
11+
}
12+
13+
::-webkit-scrollbar-track {
14+
background: transparent;
15+
}
16+
17+
::-webkit-scrollbar-thumb {
18+
background: #cbd5e1;
19+
border-radius: 4px;
20+
transition: background 0.2s;
21+
}
22+
23+
::-webkit-scrollbar-thumb:hover {
24+
background: #94a3b8;
25+
}
26+
27+
.dark ::-webkit-scrollbar-thumb {
28+
background: #4b5563;
29+
}
30+
31+
.dark ::-webkit-scrollbar-thumb:hover {
32+
background: #6b7280;
33+
}
34+
35+
* {
36+
scrollbar-width: thin;
37+
scrollbar-color: #cbd5e1 transparent;
38+
}
39+
40+
.dark * {
41+
scrollbar-color: #4b5563 transparent;
42+
}
743
}
844

945
@layer components {

0 commit comments

Comments
 (0)