Skip to content

Commit

Permalink
Export props
Browse files Browse the repository at this point in the history
  • Loading branch information
matthunz committed Oct 27, 2023
1 parent 6f677c1 commit a664fb4
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 30 deletions.
15 changes: 9 additions & 6 deletions lookbook/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ fn Home(cx: Scope) -> Element {
}

fn app(cx: Scope) -> Element {
render!(
LookBook {
home: Home,
previews: [ButtonPreview, TabRowPreview, TextButtonPreview, TextFieldPreview]
}
)
render!(LookBook {
home: Home,
previews: [
ButtonPreview,
TabRowPreview,
TextButtonPreview,
TextFieldPreview
]
})
}

fn main() {
Expand Down
9 changes: 6 additions & 3 deletions lookbook/src/previews/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ pub fn ButtonPreview(
#[lookbook(default = &*use_theme(cx).border_radius_medium)]
border_radius: &'a str,
) -> Element {
render!(
Button { background_color: background_color, border_radius: border_radius, onpress: |_| {}, label }
)
render!(Button {
background_color: background_color,
border_radius: border_radius,
onpress: |_| {},
label
})
}
9 changes: 6 additions & 3 deletions lookbook/src/previews/text_button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ pub fn TextButtonPreview(
#[lookbook(default = &*use_theme(cx).border_radius_medium)]
border_radius: &'a str,
) -> Element {
render!(
TextButton { color: color, border_radius: border_radius, onpress: |_| {}, label }
)
render!(TextButton {
color: color,
border_radius: border_radius,
onpress: |_| {},
label
})
}
12 changes: 5 additions & 7 deletions lookbook/src/previews/text_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ pub fn TextFieldPreview<'a>(
) -> Element<'a> {
let value = use_state(cx, || String::from("Text Field"));

render!(
TextField {
label: label,
value: value,
onchange: move |event: FormEvent| value.set(event.data.value.clone())
}
)
render!(TextField {
label: label,
value: value,
onchange: move |event: FormEvent| value.set(event.data.value.clone())
})
}
18 changes: 10 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,35 @@ mod button;
pub use button::{Button, ButtonProps, TextButton, TextButtonProps};

mod chip;
pub use chip::Chip;
pub use chip::{Chip, ChipProps};

mod dialog;
pub use dialog::Dialog;
pub use dialog::{Dialog, DialogProps};

mod icon;
pub use icon::{Icon, IconFont};
pub use icon::{Icon, IconFont, IconProps};

mod icon_kind;
pub use icon_kind::IconKind;

mod menu;

mod navigation_rail;
pub use navigation_rail::{NavigationRail, NavigationRailItem};
pub use navigation_rail::{
NavigationRail, NavigationRailItem, NavigationRailItemProps, NavigationRailProps,
};

mod ripple;
pub use ripple::Ripple;
pub use ripple::{Ripple, RippleProps};

mod tab;
pub use tab::Tab;
pub use tab::{Tab, TabProps};

mod tab_row;
pub use tab_row::TabRow;
pub use tab_row::{TabRow, TabRowProps};

mod theme;
pub use theme::{use_theme, Theme, UseTheme};
pub use theme::{use_theme, Theme, ThemeProps, UseTheme};

mod text_field;
pub use text_field::TextField;
9 changes: 6 additions & 3 deletions src/tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ use dioxus::prelude::*;

#[component]
pub fn Tab<'a>(cx: Scope<'a>, children: Element<'a>) -> Element<'a> {
render!(
div { font_size: "1.2em", padding: "10px 0", text_align: "center", children }
)
render!(div {
font_size: "1.2em",
padding: "10px 0",
text_align: "center",
children
})
}

0 comments on commit a664fb4

Please sign in to comment.