summaryrefslogtreecommitdiff
path: root/webapp/src/components/trick_in_play.rs
blob: 720fec0c100bd5ad925c347658c13a1a479a5a6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use crate::bridge_engine::TurnInPlay;
use crate::components::Card;
use yew::prelude::*;

#[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: TurnInPlay,
}