Skip to content

Commit

Permalink
clean up dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
marc2332 committed Feb 8, 2025
1 parent 0d4262e commit 0fd908a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions crates/components/src/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ pub struct BodyProps {
/// Height of the Body.
#[props(default = "fill".to_string())]
pub height: String,
/// Direction of the Body.
#[props(default = "vertical".to_string())]
pub direction: String,
}

/// Usually used to wrap the application root component.
Expand Down Expand Up @@ -53,6 +56,7 @@ pub fn Body(
padding,
width,
height,
direction,
}: BodyProps,
) -> Element {
let theme = use_applied_theme!(&theme, body);
Expand All @@ -66,6 +70,7 @@ pub fn Body(
background: "{background}",
spacing,
padding,
direction,
{&children}
}
)
Expand Down
8 changes: 4 additions & 4 deletions crates/components/src/dropdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ where
a11y_member_of,
background: "{background}",
border,
padding: "6 22 6 16",
padding: "6 10",
corner_radius: "6",
main_align: "center",
onmouseenter,
Expand Down Expand Up @@ -321,6 +321,7 @@ where
rsx!(
rect {
direction: "vertical",
spacing: "4",
rect {
width: "{width}",
onmouseenter,
Expand All @@ -333,9 +334,8 @@ where
background: "{background}",
color: "{font_theme.color}",
corner_radius: "8",
padding: "8 16",
padding: "6 16",
border,
shadow: "0 4 5 0 rgb(0, 0, 0, 0.1)",
direction: "horizontal",
main_align: "center",
cross_align: "center",
Expand Down Expand Up @@ -365,7 +365,7 @@ where
overflow: "clip",
corner_radius: "8",
background: "{dropdown_background}",
shadow: "0 4 5 0 rgb(0, 0, 0, 0.3)",
shadow: "0 2 4 0 rgb(0, 0, 0, 0.15)",
padding: "6",
content: "fit",
{props.children}
Expand Down
4 changes: 3 additions & 1 deletion examples/dropdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ fn app() -> Element {
let mut selected_dropdown = use_signal(|| "First Option".to_string());

rsx!(
rect {
Body {
direction: "horizontal",
padding: "4",
spacing: "4",
Dropdown {
theme: theme_with!(DropdownTheme {
width: "200".into(),
Expand Down

0 comments on commit 0fd908a

Please sign in to comment.