dioxus_tw_components/components/molecules/toast/
style.rs1use super::props::*;
2use crate::attributes::*;
3
4impl Class for ToasterProps {
5 fn base(&self) -> &'static str {
6 "fixed z-50 w-full md:max-w-[400px] bottom-0 right-0"
7 }
8}
9
10impl Class for Toast {
11 fn base(&self) -> &'static str {
12 "relative group bg-background text-foreground text-sm border border-border shadow-global-shadow p-4 m-2 rounded-global-radius"
13 }
14
15 fn color(&self) -> Option<&'static str> {
17 Some(match self.color {
18 Color::Primary => "bg-primary text-primary-foreground",
19 Color::Secondary => "bg-secondary text-secondary-foreground",
20 Color::Destructive => "bg-destructive text-destructive-foreground",
21 Color::Success => "bg-success text-success-foreground",
22 _ => "bg-background text-foreground",
23 })
24 }
25
26 fn animation(&self) -> Option<&'static str> {
27 Some(match self.animation {
28 Animation::Light | Animation::Full => {
29 "transition-all duration-150 data-[state=opening]:translate-y-full data-[state=open]:translate-y-0 data-[state=closing]:translate-x-full"
30 }
31 _ => "",
32 })
33 }
34}