Skip to content

Commit d54806a

Browse files
author
linzehao
committed
refactor(ui): 优化 PromptPanel 组件中版本选择按钮的样式和布局
- 调整版本选择按钮的样式,使其在不同屏幕宽度下都能良好显示- 添加相对定位和额外样式,以修复移动端和小屏幕下的样式问题 - 优化 HTML 结构,提高组件的可维护性
1 parent 29b75a9 commit d54806a

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

packages/ui/src/components/PromptPanel.vue

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
<div class="flex flex-col h-full">
33
<!-- 标题和按钮区域 -->
44
<div class="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-2 sm:gap-0 mb-3 flex-none">
5-
<div class="flex items-center gap-3">
5+
<div class="flex items-center gap-3 flex-wrap">
66
<h3 class="text-lg font-semibold theme-text">{{ t('prompt.optimized') }}</h3>
7-
<div v-if="versions && versions.length > 0" class="flex items-center gap-1">
7+
<div v-if="versions && versions.length > 0"
8+
class="flex items-center gap-1 version-container"
9+
style="position: relative;">
810
<button
911
v-for="version in versions.slice().reverse()"
1012
:key="version.id"
1113
@click="switchVersion(version)"
12-
class="px-2 py-1 text-xs rounded transition-colors"
14+
class="px-2 py-1 text-xs rounded transition-colors flex-shrink-0"
1315
:class="[
1416
currentVersionId === version.id
1517
? 'font-medium theme-prompt-version-selected'
@@ -20,7 +22,7 @@
2022
</button>
2123
</div>
2224
</div>
23-
<div class="flex items-center space-x-4">
25+
<div class="flex items-center space-x-4 flex-shrink-0">
2426
<button
2527
v-if="optimizedPrompt"
2628
@click="handleIterate"
@@ -244,4 +246,17 @@ textarea {
244246
textarea::-webkit-scrollbar {
245247
display: none; /* Chrome, Safari and Opera */
246248
}
249+
250+
/* 版本容器样式 */
251+
.version-container {
252+
display: flex;
253+
flex-wrap: wrap;
254+
gap: 4px;
255+
}
256+
257+
@media (max-width: 640px) {
258+
.version-container {
259+
margin-top: 4px;
260+
}
261+
}
247262
</style>

0 commit comments

Comments
 (0)