From a5c00caa80d17224c36df89f3b4d5c20996f45c7 Mon Sep 17 00:00:00 2001 From: xfy Date: Fri, 3 Jul 2026 10:26:14 +0800 Subject: [PATCH] =?UTF-8?q?style(admin/posts):=20=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E5=88=97=E5=8A=A0=E5=AE=BD=E6=A8=AA=E6=8E=92=EF=BC=8C=E9=87=8D?= =?UTF-8?q?=E5=BB=BA=E6=8C=89=E9=92=AE=20loading=20=E7=94=A8=20spinner=20?= =?UTF-8?q?=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 操作列宽 w-24 → w-44,三个按钮一行排开不换行 - 重建按钮 loading 态由「重建中...」文案改为 spinner 图标 + 「重建中」 - spinner 复用 public/icons/90-ring-with-gradient.svg,作为 SPINNER_SVG 常量收入 ui.rs(修正原 SVG 损坏的孤立 ':' 选择器,重命名 id/类名 避免多处内联时冲突),用 currentColor 继承按钮文字色 --- src/components/ui.rs | 6 ++++++ src/pages/admin/posts.rs | 14 +++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/components/ui.rs b/src/components/ui.rs index b43ca5d..b307f6a 100644 --- a/src/components/ui.rs +++ b/src/components/ui.rs @@ -29,6 +29,12 @@ pub const ADMIN_ROW_HOVER: &str = /// 列表复选框统一样式(全选表头 + 行内)。 pub const CHECKBOX_CLASS: &str = "rounded border-paper-border"; +/// 行内加载 spinner:环形渐变 + 自旋动画,用 currentColor 继承文字色。 +/// +/// 内联 SVG(含 `@keyframes`),通过 `dangerous_inner_html` 注入;尺寸由外层 +/// Tailwind 类(如 `w-3.5 h-3.5`)控制。源文件 `public/icons/90-ring-with-gradient.svg`。 +pub const SPINNER_SVG: &str = r#""#; + /// 状态徽章外层:小号圆角胶囊。 pub const BADGE_BASE: &str = "inline-flex items-center px-2 py-0.5 rounded text-xs font-medium whitespace-nowrap"; diff --git a/src/pages/admin/posts.rs b/src/pages/admin/posts.rs index f1d71c7..3bf3c03 100644 --- a/src/pages/admin/posts.rs +++ b/src/pages/admin/posts.rs @@ -17,6 +17,7 @@ use crate::components::skeletons::delayed_skeleton::DelayedSkeleton; use crate::components::skeletons::posts_skeleton::PostsSkeleton; use crate::components::ui::{ Pagination, StatusBadge, ADMIN_ROW_HOVER, ADMIN_TABLE_CLASS, BTN_TEXT_ACCENT, BTN_TEXT_RED, + SPINNER_SVG, }; use crate::hooks::query::use_paginated; use crate::models::post::PostListItem; @@ -118,7 +119,7 @@ pub fn PostsPage(page: i32) -> Element { "状态" } th { class: "px-4 py-3 font-medium w-32", "日期" } - th { class: "px-4 py-3 font-medium w-24 text-right", + th { class: "px-4 py-3 font-medium w-44 text-right", "操作" } } @@ -302,11 +303,18 @@ fn PostRow( "编辑" } button { - class: if rebuilding { "text-xs text-paper-secondary cursor-not-allowed" } else { BTN_TEXT_ACCENT }, + class: if rebuilding { + "inline-flex items-center gap-1 text-xs text-paper-secondary cursor-not-allowed" + } else { + BTN_TEXT_ACCENT + }, disabled: rebuilding, onclick: move |_| on_rebuild.call(post.id), if rebuilding { - "重建中..." + {rsx! { + span { dangerous_inner_html: SPINNER_SVG } + "重建中" + }} } else { "重建" }