From cbd76895acce541b5036aa0ff5d88780d6c816a6 Mon Sep 17 00:00:00 2001 From: Joel Therrien Date: Thu, 10 Aug 2023 21:43:14 -0700 Subject: [PATCH] Add styling to grid and allow moving ephemeral tiles --- ui/src/elements.tsx | 89 ++++++++++++++++++++++++++++++++------------- ui/src/style.less | 27 +++++++++++++- 2 files changed, 88 insertions(+), 28 deletions(-) diff --git a/ui/src/elements.tsx b/ui/src/elements.tsx index 5e8065e..21e1000 100644 --- a/ui/src/elements.tsx +++ b/ui/src/elements.tsx @@ -17,6 +17,41 @@ enum CellType { Start = "Start", } +function cell_type_to_details(cell_type: CellType): {className: string, text: string} { + let className: string; + let text: string; + + switch (cell_type) { + case CellType.Normal: + className = "grid-spot-normal"; + text = ""; + break; + case CellType.DoubleWord: + className = "grid-spot-double-word"; + text = "Double Word Score"; + break; + case CellType.DoubleLetter: + className = "grid-spot-double-letter"; + text = "Double Letter Score"; + break; + case CellType.TripleLetter: + className = "grid-spot-triple-letter"; + text = "Triple Letter Score"; + break; + case CellType.TripleWord: + className = "grid-spot-triple-word"; + text = "Triple Word Score"; + break; + case CellType.Start: + className = "grid-spot-start"; + text = "★"; + break; + + } + + return {className: className, text: text}; +} + export interface CoordinateData { location: LocationType; index: number; @@ -83,7 +118,7 @@ export function Game(props: {wasm: GameWasm}) { return <> - +