Skip to main content

yggdrasil/components/skeletons/
atoms.rs

1//! 骨架屏原子组件
2//!
3//! 提供通用的脉冲动画占位块,供各页面骨架屏组合使用。
4
5use dioxus::prelude::*;
6
7/// 通用骨架占位块。
8///
9/// Props:
10/// - `class`:Tailwind CSS 类,控制尺寸与形状
11/// - `style`:可选的内联样式字符串
12///
13/// 默认带有 `animate-pulse` 动画与半透明的占位背景。
14#[component]
15pub fn SkeletonBox(class: &'static str, style: Option<&'static str>) -> Element {
16    rsx! {
17        div {
18            class: "bg-paper-tertiary/30 dark:bg-gray-600 animate-pulse {class}",
19            style: style.unwrap_or(""),
20        }
21    }
22}