refactor(web): 采用 Button/Card 原语替换多处手搓样式
This commit is contained in:
@@ -3,8 +3,10 @@
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
|
||||
import { useToast } from "@/components/Toast";
|
||||
import { Button } from "@/components/ui/Button";
|
||||
import { api } from "@/lib/api/client";
|
||||
import type { TemplateResponse } from "@/lib/api/types";
|
||||
import { buttonClass } from "@/lib/ui/variants";
|
||||
|
||||
interface TemplateFillerProps {
|
||||
// 可填入的目标输入字段名(如 brief / text);空 → 不渲染(无可填字段)。
|
||||
@@ -44,13 +46,14 @@ export function TemplateFiller({ targetField, onFill }: TemplateFillerProps) {
|
||||
|
||||
if (!open) {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
onClick={() => setOpen(true)}
|
||||
className="self-start rounded border border-line px-3 py-1 text-sm text-ink-soft hover:text-ink"
|
||||
className="self-start"
|
||||
>
|
||||
从模板填入
|
||||
</button>
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -61,13 +64,13 @@ export function TemplateFiller({ targetField, onFill }: TemplateFillerProps) {
|
||||
>
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="text-sm text-ink-soft">选一个模板填入「{field}」</span>
|
||||
<button
|
||||
type="button"
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => setOpen(false)}
|
||||
className="text-xs text-ink-soft hover:text-ink"
|
||||
>
|
||||
收起
|
||||
</button>
|
||||
</Button>
|
||||
</div>
|
||||
{templates === null ? (
|
||||
<p className="text-sm text-ink-soft">加载中…</p>
|
||||
@@ -84,7 +87,10 @@ export function TemplateFiller({ targetField, onFill }: TemplateFillerProps) {
|
||||
setOpen(false);
|
||||
toast(`已填入模板「${t.title}」。`, "success");
|
||||
}}
|
||||
className="w-full rounded border border-line px-3 py-2 text-left text-sm text-ink hover:border-cinnabar"
|
||||
className={buttonClass({
|
||||
variant: "secondary",
|
||||
className: "w-full justify-start text-left text-ink",
|
||||
})}
|
||||
>
|
||||
<span className="font-serif">{t.title}</span>
|
||||
{t.tool_key ? (
|
||||
|
||||
Reference in New Issue
Block a user