summaryrefslogtreecommitdiff
path: root/src/view/property_group.rs
diff options
context:
space:
mode:
authorjelemux <jeremias.weber@protonmail.com>2021-02-18 19:55:42 +0100
committerjelemux <jeremias.weber@protonmail.com>2021-02-18 19:55:42 +0100
commitac31460bac3c050abe1e45ec975f3537d1937751 (patch)
treec5e0da8354a2f276e0a584c166fd2e824d9aec3e /src/view/property_group.rs
parente85c3283d4ea5d5d2f0bb7e6cdd6c48ddb9a786b (diff)
downloadwasm-card-ac31460bac3c050abe1e45ec975f3537d1937751.tar.gz
wasm-card-ac31460bac3c050abe1e45ec975f3537d1937751.tar.bz2
add delete buttons
Diffstat (limited to 'src/view/property_group.rs')
-rw-r--r--src/view/property_group.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/view/property_group.rs b/src/view/property_group.rs
index f4b62a4..1905cac 100644
--- a/src/view/property_group.rs
+++ b/src/view/property_group.rs
@@ -9,6 +9,7 @@ pub struct InputProps<
M: 'static + PartialEq + Clone,
> {
pub generated: Callback<O>,
+ pub delete: Callback<()>,
pub weak_link: WeakComponentLink<PropertyGroupInputComponent<O, M>>,
}
@@ -43,12 +44,20 @@ impl<O: 'static + VCardPropertyInputGroupObject<M>, M: 'static + PartialEq + Clo
}
fn view(&self) -> yew::virtual_dom::VNode {
let link = self.props.weak_link.borrow().clone().unwrap();
+ let delete = self.props.delete.clone();
html! {
<div class="box">
{ self.render_error() }
- <h3 class="subtitle">{ self.value.get_title() }</h3>
+ <div class="level">
+ <div class="level-left">
+ <h3 class="subtitle">{ self.value.get_title() }</h3>
+ </div>
+ <div class="level-right">
+ <button onclick=Callback::once(move |_| delete.emit(())) class="delete"></button>
+ </div>
+ </div>
{ self.value.render(&link) }