dioxus_tw_components/components/organisms/form/input/
style.rs

1use super::props::*;
2use crate::attributes::*;
3use dioxus::prelude::*;
4
5impl Class for InputProps {
6    fn base(&self) -> &'static str {
7        "peer flex w-full px-2 py-1.5 text-foreground bg-background border rounded-global-radius hover:brightness-105 focus:outline-hidden focus:brightness-105 focus:ring-ring focus:ring-offset-2 focus:ring-2 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:brightness-100 file:font-medium file:bg-input file:rounded-xs file:border-0 file:items-center file:justify-center"
8    }
9
10    fn color(&self) -> Option<&'static str> {
11        Some(match *self.color.read() {
12            Color::Primary => "border-primary",
13            Color::Secondary => "border-secondary",
14            Color::Destructive => "border-destructive",
15            Color::Success => "border-success",
16            _ => "border-input",
17        })
18    }
19
20    fn size(&self) -> Option<&'static str> {
21        Some(match *self.size.read() {
22            Size::Xs => "h-4 text-xs",
23            Size::Sm => "h-6 text-xs",
24            Size::Md => "h-9 text-sm",
25            Size::Lg => "h-11 text-base",
26            Size::Xl => "h-14 text-lg",
27        })
28    }
29}