Skip to content

Commit

Permalink
zu: Set default value of button component to button
Browse files Browse the repository at this point in the history
  • Loading branch information
XuShaohua committed Jul 21, 2023
1 parent b4bdd0b commit a4f6622
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/zu/src/button/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub struct Props {
#[prop_or_default]
pub color: Color,

#[prop_or_default]
#[prop_or(AttrValue::from("button"))]
pub component: AttrValue,

/// If true, the component is disabled.
Expand Down
8 changes: 4 additions & 4 deletions crates/zu/src/button_base/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ use zu_util::prop::ToAttr;

pub use touch_ripple::TouchRipple;

pub const DEFAULT_LINK_COMPONENT: &str = "a";

#[derive(Debug, Clone, PartialEq, Properties)]
pub struct Props {
#[prop_or_default]
Expand Down Expand Up @@ -64,8 +62,8 @@ pub struct Props {

/// The component used to render a link when the href prop is provided.
///
/// Default is 'a'
#[prop_or(AttrValue::from(DEFAULT_LINK_COMPONENT))]
/// Default is `a`.
#[prop_or(AttrValue::from("a"))]
pub link_component: AttrValue,

#[prop_or_default]
Expand Down Expand Up @@ -129,6 +127,8 @@ pub struct Props {

#[function_component(ButtonBase)]
pub fn button_base(props: &Props) -> Html {
debug_assert!(!props.component.is_empty());

let focus_visible = use_state(|| false);

let root_cls = classes!(
Expand Down

0 comments on commit a4f6622

Please sign in to comment.