dioxus_tw_components/components/molecules/dropdown/
style.rs

1use super::props::*;
2use crate::attributes::*;
3use dioxus::prelude::*;
4
5impl Class for DropdownProps {
6    fn base(&self) -> &'static str {
7        "z-20 relative text-foreground"
8    }
9}
10
11impl Class for DropdownToggleProps {
12    fn base(&self) -> &'static str {
13        "px-4 py-2 text-sm font-medium bg-background border border-input rounded-global-radius whitespace-nowrap hover:bg-accent hover:text-accent-foreground select-none cursor-pointer"
14    }
15}
16
17impl Class for DropdownContentProps {
18    fn base(&self) -> &'static str {
19        "z-20 p-2 space-y-2 min-w-[8rem] bg-background rounded-global-radius border border-input shadow-global-shadow absolute mt-2 left-1/2 -translate-x-1/2 whitespace-nowrap opacity-100 data-[state=inactive]:invisible"
20    }
21
22    fn animation(&self) -> Option<&'static str> {
23        Some(match *self.animation.read() {
24            Animation::None => "transition-none",
25            Animation::Light | Animation::Full => {
26                "transition-all duration-100 data-[state=inactive]:scale-90 data-[state=active]:scale-100 data-[state=inactive]:opacity-0"
27            }
28        })
29    }
30}