summaryrefslogtreecommitdiff
path: root/webapp/src/components
diff options
context:
space:
mode:
authorKjetil Orbekk <kj@orbekk.com>2022-09-07 21:38:55 -0400
committerKjetil Orbekk <kj@orbekk.com>2022-09-07 21:38:55 -0400
commit761e2b5c0526987b8a56c52b2b11e2ed99e37396 (patch)
treee7befdd4167990bc7761fb797191004e7ac13cf8 /webapp/src/components
parentf92ca7acbf6998f8cd2cb6b7e1116fcbd29767e4 (diff)
Start working on game layout
Diffstat (limited to 'webapp/src/components')
-rw-r--r--webapp/src/components/game.rs37
-rw-r--r--webapp/src/components/hand.rs9
2 files changed, 24 insertions, 22 deletions
diff --git a/webapp/src/components/game.rs b/webapp/src/components/game.rs
index d31433d..33fb5b7 100644
--- a/webapp/src/components/game.rs
+++ b/webapp/src/components/game.rs
@@ -47,22 +47,27 @@ pub fn game() -> Html {
html! {
<>
- <p>{ format!("Dealer: {:?}", *dealer) }</p>
- if let Some((contract, bidding)) = &*contract {
- { format!("Got contract {:?}. Bidding was {:?}", contract, bidding) }
- } else {
- <Bidding {on_contract} dealer={ *dealer } />
- }
- <p>{ "North" }</p>
- <Hand ..(*north).clone() />
- <p>{ "West" }</p>
- <Hand ..(*west).clone() />
- <p>{ "South" }</p>
- <Hand ..(*south).clone() />
- <p>{ "East" }</p>
- <Hand ..(*east).clone() />
- <p>{ "Controls" }</p>
- <button onclick={shuffle}>{ "Shuffle" }</button>
+ <div class="center">
+ <p>{ format!("Dealer: {:?}", *dealer) }</p>
+ if let Some((contract, bidding)) = &*contract {
+ { format!("Got contract {:?}. Bidding was {:?}", contract, bidding) }
+ } else {
+ <Bidding {on_contract} dealer={ *dealer } />
+ }
+ <button onclick={shuffle}>{ "Shuffle" }</button>
+ </div>
+ <div class="hand west">
+ <Hand ..(*west).clone() />
+ </div>
+ <div class="hand north">
+ <Hand ..(*north).clone() />
+ </div>
+ <div class="hand east">
+ <Hand ..(*east).clone() />
+ </div>
+ <div class="hand south">
+ <Hand ..(*south).clone() />
+ </div>
</>
}
}
diff --git a/webapp/src/components/hand.rs b/webapp/src/components/hand.rs
index 1a2727c..85b4dd2 100644
--- a/webapp/src/components/hand.rs
+++ b/webapp/src/components/hand.rs
@@ -3,20 +3,17 @@ use crate::components::card::{Card, CardProps};
#[function_component(Hand)]
pub fn hand(props: &HandProps) -> Html {
- let cards: Html = props
+ let cards = props
.cards
.iter()
.map(|c| {
html! {
<Card ..c.clone() />
}
- })
- .collect();
+ });
html! {
- <div class="hand">
- { cards }
- </div>
+ { for cards }
}
}