Card: should always use Option<Callback> and not just Callback

If you don't do this, the user can't pass an Option<Callback> at all.
This commit is contained in:
Cecile Tonglet 2023-11-07 13:55:28 +01:00
parent b01e006371
commit 848204863c

View file

@ -8,7 +8,7 @@ pub struct CardProps {
#[prop_or_default] #[prop_or_default]
pub elevation: Elevation, pub elevation: Elevation,
#[prop_or_default] #[prop_or_default]
pub onclick: Callback<MouseEvent>, pub onclick: Option<Callback<MouseEvent>>,
#[prop_or(false)] #[prop_or(false)]
pub interactive: bool, pub interactive: bool,
#[prop_or_default] #[prop_or_default]
@ -35,7 +35,8 @@ pub fn card(
interactive.then_some("bp3-interactive"), interactive.then_some("bp3-interactive"),
class.clone(), class.clone(),
)} )}
{onclick} // TODO why do I need to unwrap()? looks like an issue in Yew
onclick={onclick.clone().unwrap_or_default()}
{style} {style}
> >
{children.clone()} {children.clone()}