dioxus_tw_components/components/organisms/form/checkbox/
style.rs1use super::props::*;
2use crate::attributes::*;
3use dioxus::prelude::*;
4
5impl Class for CheckboxProps {
6 fn base(&self) -> &'static str {
7 "peer"
8 }
9
10 fn color(&self) -> Option<&'static str> {
11 Some(match *self.color.read() {
12 Color::Primary => "accent-primary focus:ring-primary focus:ring-2 focus:ring-offset-1",
13 Color::Secondary => {
14 "accent-secondary focus:ring-secondary focus:ring-2 focus:ring-offset-1"
15 }
16 Color::Destructive => {
17 "accent-destructive focus:ring-destructive focus:ring-2 focus:ring-offset-1"
18 }
19 Color::Success => "accent-success focus:ring-success focus:ring-2 focus:ring-offset-1",
20 _ => "accent-foreground focus:ring-foreground focus:ring-2 focus:ring-offset-1",
21 })
22 }
23
24 fn size(&self) -> Option<&'static str> {
25 Some(match *self.size.read() {
26 Size::Xs => "size-2",
27 Size::Sm => "size-3",
28 Size::Md => "",
29 Size::Lg => "size-5",
30 Size::Xl => "size-8",
31 })
32 }
33}