dioxus_tw_components/components/atoms/placeholder/
style.rs1use super::props::*;
2use crate::attributes::*;
3use dioxus::prelude::*;
4
5impl Class for PlaceholderProps {
6 fn base(&self) -> &'static str {
7 "rounded-global-radius w-24 h-24"
8 }
9
10 fn color(&self) -> Option<&'static str> {
11 Some(match *self.color.read() {
12 Color::Default => "bg-foreground/20",
13 Color::Primary => "bg-primary/20",
14 Color::Secondary => "bg-secondary/20",
15 Color::Destructive => "bg-destructive/20",
16 Color::Success => "bg-success/20",
17 Color::Accent => "bg-accent/20",
18 Color::Muted => "bg-muted/20",
19 })
20 }
21
22 fn animation(&self) -> Option<&'static str> {
23 Some(match *self.animation.read() {
24 Animation::None => "",
25 Animation::Light => "animate-pulse",
26 Animation::Full => {
27 "relative overflow-hidden before:absolute before:inset-0 before:-translate-x-full before:bg-linear-to-r before:from-transparent before:via-white/40 before:animate-[shimmer_2s_infinite]"
28 }
29 })
30 }
31}