diff --git a/yewprint-doc/src/callout/mod.rs b/yewprint-doc/src/callout/mod.rs index f281d5d..e3c683a 100644 --- a/yewprint-doc/src/callout/mod.rs +++ b/yewprint-doc/src/callout/mod.rs @@ -3,7 +3,7 @@ mod example; use crate::ExampleContainer; use example::*; use yew::prelude::*; -use yewprint::{Intent, Menu, MenuItem, Switch, H1, H5}; +use yewprint::{HtmlSelect, Intent, Switch, H1, H5}; pub struct CalloutDoc { callback: Callback, @@ -84,47 +84,19 @@ crate::build_example_prop_component! { label="Show/hide title" />

{"Select intent:"}

- - - - - - - + > + options={vec![ + (None, "None".to_string()), + (Some(Intent::Primary), "Primary".to_string()), + (Some(Intent::Success), "Success".to_string()), + (Some(Intent::Warning), "Warning".to_string()), + (Some(Intent::Danger), "Danger".to_string()), + ]} + onchange=self.update_props(|props, intent| ExampleProps { + intent, + ..props + }) + /> } diff --git a/yewprint-doc/src/progressbar/mod.rs b/yewprint-doc/src/progressbar/mod.rs index e6d9290..2a2aba5 100644 --- a/yewprint-doc/src/progressbar/mod.rs +++ b/yewprint-doc/src/progressbar/mod.rs @@ -3,7 +3,7 @@ mod example; use crate::ExampleContainer; use example::*; use yew::prelude::*; -use yewprint::{Intent, Menu, MenuItem, Switch, H1, H5}; +use yewprint::{HtmlSelect, Intent, Switch, H1, H5}; pub struct ProgressBarDoc { callback: Callback, @@ -84,47 +84,19 @@ crate::build_example_prop_component! { label="Animate" />

{"Select intent:"}

- - - - - - - + > + options={vec![ + (None, "None".to_string()), + (Some(Intent::Primary), "Primary".to_string()), + (Some(Intent::Success), "Success".to_string()), + (Some(Intent::Warning), "Warning".to_string()), + (Some(Intent::Danger), "Danger".to_string()), + ]} + onchange=self.update_props(|props, intent| ExampleProps { + intent, + ..props + }) + /> } diff --git a/yewprint-doc/src/tag/mod.rs b/yewprint-doc/src/tag/mod.rs index 880057d..25ffe07 100644 --- a/yewprint-doc/src/tag/mod.rs +++ b/yewprint-doc/src/tag/mod.rs @@ -3,7 +3,7 @@ mod example; use crate::ExampleContainer; use example::*; use yew::prelude::*; -use yewprint::{Button, Intent, Menu, MenuItem, Switch, H1, H5}; +use yewprint::{Button, HtmlSelect, IconName, Intent, Switch, H1, H5}; pub struct TagDoc { callback: Callback, @@ -171,56 +171,31 @@ crate::build_example_prop_component! { checked=self.props.right_icon label="Right icon" /> - -

{"Select intent:"}

- - + + > + {"Reset tags"} + } diff --git a/yewprint/src/lib.rs b/yewprint/src/lib.rs index de6f20b..db0fdbb 100644 --- a/yewprint/src/lib.rs +++ b/yewprint/src/lib.rs @@ -58,7 +58,7 @@ macro_rules! if_html { // NOTE: this class needs to become deprecated when the feature bool_to_option lands in stable // // https://github.com/rust-lang/rust/issues/64260 -#[derive(Debug, Copy, Clone, PartialEq, Default)] +#[derive(Debug, Copy, Clone, PartialEq, Hash, Default)] pub struct ConditionalClass(bool); impl Transformer for VComp { @@ -119,7 +119,7 @@ impl Not for ConditionalClass { } } -#[derive(Debug, Copy, Clone, PartialEq)] +#[derive(Debug, Copy, Clone, PartialEq, Hash)] pub enum Intent { Primary, Success, @@ -144,7 +144,7 @@ impl AsRef for Intent { } } -#[derive(Clone, Copy, PartialEq, Eq, Debug)] +#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)] pub enum Elevation { Level0, Level1,