Skip to main content

yggdrasil/components/ui/
styles.rs

1//! 共享样式常量与 spinner 标记。
2// ===========================================================================
3// 样式常量
4// ===========================================================================
5
6/// 行内加载 spinner:环形渐变 + 自旋动画,用 currentColor 继承文字色。
7///
8/// 内联 SVG(含 `@keyframes`),通过 `inner_html` 注入;尺寸由外层
9/// Tailwind 类(如 `w-3.5 h-3.5`)控制。源文件 `public/icons/90-ring-with-gradient.svg`。
10pub const SPINNER_SVG: &str = r#"<svg class="w-3.5 h-3.5" fill="none" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="yggSpinnerGrad"><stop offset="0%" stop-color="currentColor" stop-opacity="1"/><stop offset="100%" stop-color="currentColor" stop-opacity="0.25"/></linearGradient></defs><style>@keyframes yggSpin { to { transform: rotate(360deg); } } .ygg-spinner-circle { transform-origin: 50% 50%; stroke: url(#yggSpinnerGrad); fill: none; animation: yggSpin .5s infinite linear; }</style><circle cx="10" cy="10" r="8" class="ygg-spinner-circle" stroke-width="2"/></svg>"#;
11
12/// 徽章底座(`.badge`,中性色);语气追加 `badge-clay` / `badge-success` /
13/// `badge-warning` / `badge-danger`。
14pub const BADGE_BASE: &str = "badge";
15
16// --- 按钮 ---
17//
18// 样式定义在 styles/components/ui.css(`.btn` 系列)。新代码优先用 `Button` /
19// `IconButton` 组件;这些常量供 `<a>`、`label` 等非按钮元素与旧页面沿用,
20// 页面重写时逐步收敛。
21
22/// 次要按钮:浅灰底。
23pub const BTN_SECONDARY: &str = "btn btn-secondary";
24
25// ===========================================================================
26// 组件