summaryrefslogtreecommitdiff
path: root/webapp/src/components/trick_in_play.rs
diff options
context:
space:
mode:
authorKjetil Orbekk <kj@orbekk.com>2022-09-22 09:15:09 -0400
committerKjetil Orbekk <kj@orbekk.com>2022-09-22 09:15:09 -0400
commit030b45c000210b153b5ef224ddcaa668de763638 (patch)
treedfeb3d8c6ee803c41b96b2dd3f6da0fbe38614b2 /webapp/src/components/trick_in_play.rs
parentd66f16ae60190eebe711f7f2fb931513d711cd32 (diff)
Add component for current trick
Diffstat (limited to 'webapp/src/components/trick_in_play.rs')
-rw-r--r--webapp/src/components/trick_in_play.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/webapp/src/components/trick_in_play.rs b/webapp/src/components/trick_in_play.rs
new file mode 100644
index 0000000..086a422
--- /dev/null
+++ b/webapp/src/components/trick_in_play.rs
@@ -0,0 +1,23 @@
+use yew::prelude::*;
+use crate::bridge_engine::PlayTurn;
+use crate::components::Card;
+
+#[function_component(TrickInPlay)]
+pub fn trick_in_play(props: &TrickInPlayProps) -> Html {
+ let cards = props.in_progress.cards_played().iter().map(|card| {
+ html! {
+ <Card card={ card.clone() } />
+ }
+ });
+html! {
+ <>
+ <p>{ format!("Leader: {:?}", props.in_progress.leader()) }</p>
+ { for cards }
+ </>
+}
+}
+
+#[derive(PartialEq, Properties, Clone)]
+pub struct TrickInPlayProps {
+ pub in_progress: PlayTurn,
+}