From 435272c941d6cb8e7e18312cac16e319b16e8f50 Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Sun, 11 Sep 2022 13:03:36 -0400 Subject: Add card callbacks --- webapp/src/components/hand.rs | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to 'webapp/src/components/hand.rs') diff --git a/webapp/src/components/hand.rs b/webapp/src/components/hand.rs index bb6e372..9e1f993 100644 --- a/webapp/src/components/hand.rs +++ b/webapp/src/components/hand.rs @@ -1,16 +1,14 @@ -use yew::prelude::*; use crate::components::card::{Card, CardProps}; +use crate::card; +use yew::prelude::*; #[function_component(Hand)] pub fn hand(props: &HandProps) -> Html { - let cards = props - .cards - .iter() - .map(|c| { - html! { - - } - }); + let cards = props.cards.iter().map(|card| { + html! { + + } + }); html! { { for cards } @@ -20,16 +18,6 @@ pub fn hand(props: &HandProps) -> Html { #[derive(Clone, Default, PartialEq, Properties)] pub struct HandProps { #[prop_or_default] - pub cards: Vec, -} - -impl> FromIterator for HandProps { - fn from_iter(cards: Cards) -> Self - where - Cards: std::iter::IntoIterator, - { - HandProps { - cards: cards.into_iter().map(Into::into).collect(), - } - } + pub cards: Vec, + pub on_card_clicked: Callback, } -- cgit v1.2.3