refactor: add style prop to SkeletonBox, migrate last tags_skeleton div
This commit is contained in:
parent
4fbc938422
commit
71abff1b3e
@ -1,10 +1,11 @@
|
|||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn SkeletonBox(class: &'static str) -> Element {
|
pub fn SkeletonBox(class: &'static str, style: Option<&'static str>) -> Element {
|
||||||
rsx! {
|
rsx! {
|
||||||
div {
|
div {
|
||||||
class: "bg-gray-200 dark:bg-[#2a2a2a] animate-pulse {class}",
|
class: "bg-gray-200 dark:bg-[#2a2a2a] animate-pulse {class}",
|
||||||
|
style: style.unwrap_or(""),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,9 +18,8 @@ pub fn TagsSkeleton() -> Element {
|
|||||||
div { class: "flex flex-wrap gap-4 mt-6",
|
div { class: "flex flex-wrap gap-4 mt-6",
|
||||||
// 生成 24 个不同宽度的标签 pill
|
// 生成 24 个不同宽度的标签 pill
|
||||||
for i in 0..24 {
|
for i in 0..24 {
|
||||||
div {
|
SkeletonBox {
|
||||||
class: "h-8 bg-gray-200 dark:bg-[#2a2a2a] rounded-lg animate-pulse",
|
class: "h-8 rounded-lg",
|
||||||
// 不同宽度模拟标签名长短
|
|
||||||
style: match i % 6 {
|
style: match i % 6 {
|
||||||
0 => "width: 60px;",
|
0 => "width: 60px;",
|
||||||
1 => "width: 80px;",
|
1 => "width: 80px;",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user