diff --git a/src/assets/sample_game.json b/src/assets/sample_game.json index ef63236..97c5ca5 100644 --- a/src/assets/sample_game.json +++ b/src/assets/sample_game.json @@ -7,27 +7,33 @@ { "value": 200, "clue": "This is clue 1.1", - "solution": "What is the solution to clue 1.1?" + "solution": "What is the solution to clue 1.1?", + "image": "https://picsum.photos/1000/1000" }, { "value": 400, "clue": "This is clue 1.2", - "solution": "What is the solution to clue 1.2?" + "solution": "What is the solution to clue 1.2?", + "image": "https://picsum.photos/1000/1000" }, { "value": 600, "clue": "This is clue 1.3", - "solution": "What is the solution to clue 1.3?" + "solution": "What is the solution to clue 1.3?", + "image": "https://picsum.photos/1000/1000" }, { "value": 800, "clue": "This is clue 1.4", - "solution": "What is the solution to clue 1.4?" + "solution": "What is the solution to clue 1.4?", + "image": "https://picsum.photos/1000/1000" }, { "value": 1000, "clue": "This is clue 1.5", - "solution": "What is the solution to clue 1.5?" + "solution": "What is the solution to clue 1.5?", + "dailyDouble": true, + "image": "https://picsum.photos/1000/1000" } ] }, diff --git a/src/components/JeopardyBoard.css b/src/components/JeopardyBoard.css index 9024f1c..dcc0203 100644 --- a/src/components/JeopardyBoard.css +++ b/src/components/JeopardyBoard.css @@ -95,6 +95,47 @@ td.board-clue { min-height: 600px; box-sizing: border-box; padding: 20px; + display: flex; + align-items: center; + justify-content: center; +} + +.clue-content { + display: flex; + width: 100%; + height: 100%; +} + +.clue-content.has-image .clue-image { + width: 50%; + height: 100%; + object-fit: cover; +} + +.clue-content.has-image .clue-text { + width: 50%; + display: flex; + align-items: center; + justify-content: center; +} + +.clue-content.no-image .clue-text { + width: 100%; + display: flex; + align-items: center; + justify-content: center; +} + +.clue-content.no-image .clue-image { + display: none; +} + +.clue-content.solution-shown .clue-image { + display: none; +} + +.clue-content.solution-shown .clue-text { + width: 100%; } .final-category { @@ -117,6 +158,20 @@ td.board-clue { padding: 10px; } +.clue-image { + max-height: 500px; + margin: 20px auto; + display: block; + width: 75%; + height: 100%; + object-fit: contain; +} + +.clue-text { + width: 25%; + font-size: 0.8em; +} + @import url("https://fonts.googleapis.com/css?family=Fira+Code&display=swap"); .code { font-family: "Consolas", "Fira Code", monospace; diff --git a/src/components/JeopardyBoard.tsx b/src/components/JeopardyBoard.tsx index 9d7a017..5496d63 100644 --- a/src/components/JeopardyBoard.tsx +++ b/src/components/JeopardyBoard.tsx @@ -52,6 +52,9 @@ function JeopardyBoard(props: JeopardyBoardProps) { function renderClue(categoryName: string, clue: Clue, value: number) { const showDailyDoubleScreen = clue.dailyDouble && !dailyDoubleScreenPresented; + const hasImage = !!clue.image && !showDailyDoubleScreen && !solution; + const contentClass = hasImage ? "has-image" : "no-image"; + const solutionClass = solution && !showDailyDoubleScreen ? " solution-shown" : ""; return (