优化:图标规范生成面板的多行输入框, 按钮交互与图标样式
- 优化输入框样式,与画布编辑器一致。 - 调整按钮布局,添加间距和微调样式以提升一致性。 - 替换按钮文本为动态图标及文本组合,优化用户体验。
This commit is contained in:
@@ -1,4 +1,11 @@
|
||||
import { ClipboardList, Cpu, ImagePlus } from 'lucide-react';
|
||||
import {
|
||||
ClipboardList,
|
||||
Cpu,
|
||||
ImagePlus,
|
||||
Loader2,
|
||||
Sparkles,
|
||||
Undo2,
|
||||
} from 'lucide-react';
|
||||
import {
|
||||
type CSSProperties,
|
||||
type Dispatch,
|
||||
@@ -466,61 +473,71 @@ export function ImageCanvasSpecGenerationPanelView({
|
||||
>
|
||||
{item.title}
|
||||
</PlatformFieldLabel>
|
||||
<div>
|
||||
<PlatformTextField
|
||||
variant="textarea"
|
||||
aria-label={item.title}
|
||||
value={value}
|
||||
placeholder={item.placeholder}
|
||||
disabled={isGenerating || item.optimization.optimizing}
|
||||
size="sm"
|
||||
density="compact"
|
||||
className="image-canvas-editor__spec-textarea"
|
||||
onChange={(event) =>
|
||||
onUpdateSpecFormValue(
|
||||
item.key,
|
||||
limitIconSpecPrompt(event.target.value),
|
||||
)
|
||||
<AutoGrowTextArea
|
||||
aria-label={item.title}
|
||||
value={value}
|
||||
placeholder={item.placeholder}
|
||||
disabled={isGenerating || item.optimization.optimizing}
|
||||
className="image-canvas-editor__generation-prompt image-canvas-editor__spec-textarea"
|
||||
onChange={(event) =>
|
||||
onUpdateSpecFormValue(
|
||||
item.key,
|
||||
limitIconSpecPrompt(event.target.value),
|
||||
)
|
||||
}
|
||||
/>
|
||||
<div className="flex items-center gap-1">
|
||||
<PlatformActionButton
|
||||
type="button"
|
||||
tone="ghost"
|
||||
size="xxs"
|
||||
shape="pill"
|
||||
className="!gap-1 !px-2 !py-0.5 !text-[9px] !leading-3"
|
||||
aria-label={`一键优化${item.title}`}
|
||||
disabled={
|
||||
isGenerating ||
|
||||
item.optimization.optimizing ||
|
||||
!isValidIconSpecPrompt(value)
|
||||
}
|
||||
/>
|
||||
<div>
|
||||
onClick={() => optimizeIconSpecField(item.field)}
|
||||
>
|
||||
{item.optimization.optimizing ? (
|
||||
<>
|
||||
<Loader2
|
||||
className="h-3 w-3 animate-spin"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
正在优化
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Sparkles
|
||||
className="h-3 w-3"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
一键优化
|
||||
</>
|
||||
)}
|
||||
</PlatformActionButton>
|
||||
{item.optimization.undoValue !== null &&
|
||||
!item.optimization.optimizing ? (
|
||||
<PlatformActionButton
|
||||
type="button"
|
||||
tone="ghost"
|
||||
size="xxs"
|
||||
shape="pill"
|
||||
aria-label={`一键优化${item.title}`}
|
||||
disabled={
|
||||
isGenerating ||
|
||||
item.optimization.optimizing ||
|
||||
!isValidIconSpecPrompt(value)
|
||||
}
|
||||
onClick={() => optimizeIconSpecField(item.field)}
|
||||
className="!gap-1 !px-2 !py-0.5 !text-[9px] !leading-3"
|
||||
aria-label={`撤销${item.title}优化`}
|
||||
disabled={isGenerating}
|
||||
onClick={() => undoIconSpecOptimization(item.field)}
|
||||
>
|
||||
{item.optimization.optimizing
|
||||
? '正在优化'
|
||||
: '✦ 一键优化'}
|
||||
<Undo2
|
||||
className="h-3 w-3"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
撤销
|
||||
</PlatformActionButton>
|
||||
{item.optimization.undoValue !== null &&
|
||||
!item.optimization.optimizing ? (
|
||||
<>
|
||||
<span aria-hidden="true">|</span>
|
||||
<PlatformActionButton
|
||||
type="button"
|
||||
tone="ghost"
|
||||
size="xxs"
|
||||
shape="pill"
|
||||
aria-label={`撤销${item.title}优化`}
|
||||
disabled={isGenerating}
|
||||
onClick={() =>
|
||||
undoIconSpecOptimization(item.field)
|
||||
}
|
||||
>
|
||||
↺ 撤销
|
||||
</PlatformActionButton>
|
||||
</>
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
</label>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user