From cab440c8a209ae92eba07d50f7b7127dadbd65c0 Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Tue, 6 Sep 2022 22:07:28 -0400 Subject: Move components to a separate module --- webapp/src/components.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 webapp/src/components.rs (limited to 'webapp/src/components.rs') diff --git a/webapp/src/components.rs b/webapp/src/components.rs new file mode 100644 index 0000000..fed31b0 --- /dev/null +++ b/webapp/src/components.rs @@ -0,0 +1,27 @@ +use crate::card::Suit; + +mod card; +mod hand; +mod bidding_table; +mod bidding_box; + +pub use self::card::*; +pub use self::bidding_box::*; +pub use self::bidding_table::*; +pub use self::hand::*; + +pub fn suit_css_class(suit: Suit) -> &'static str { + match suit { + Suit::Club => "suit-club", + Suit::Diamond => "suit-diamond", + Suit::Heart => "suit-heart", + Suit::Spade => "suit-spade", + } +} + +pub fn bid_css_class(suit: Option) -> &'static str { + match suit { + None => "suit-notrump", + Some(x) => suit_css_class(x), + } +} -- cgit v1.2.3