mirror of
https://github.com/yewprint/yewprint
synced 2024-11-24 12:33:04 +00:00
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:
parent
b01e006371
commit
848204863c
1 changed files with 3 additions and 2 deletions
|
@ -8,7 +8,7 @@ pub struct CardProps {
|
|||
#[prop_or_default]
|
||||
pub elevation: Elevation,
|
||||
#[prop_or_default]
|
||||
pub onclick: Callback<MouseEvent>,
|
||||
pub onclick: Option<Callback<MouseEvent>>,
|
||||
#[prop_or(false)]
|
||||
pub interactive: bool,
|
||||
#[prop_or_default]
|
||||
|
@ -35,7 +35,8 @@ pub fn card(
|
|||
interactive.then_some("bp3-interactive"),
|
||||
class.clone(),
|
||||
)}
|
||||
{onclick}
|
||||
// TODO why do I need to unwrap()? looks like an issue in Yew
|
||||
onclick={onclick.clone().unwrap_or_default()}
|
||||
{style}
|
||||
>
|
||||
{children.clone()}
|
||||
|
|
Loading…
Reference in a new issue