From 8d8a606fb88a5f43b61644815fe478cf120d1e98 Mon Sep 17 00:00:00 2001 From: Martin Berg Alstad <600878@stud.hvl.no> Date: Sat, 15 Jul 2023 19:55:38 +0200 Subject: [PATCH] Fixed colours not showing --- .../ClientApp/src/components/gameTile.tsx | 4 ++-- .../ClientApp/src/utils/colours.ts | 10 ---------- .../ClientApp/tests/utils/colours.test.ts | 18 ------------------ pac-man-board-game/pac-man-board-game.csproj | 5 +++++ 4 files changed, 7 insertions(+), 30 deletions(-) delete mode 100644 pac-man-board-game/ClientApp/src/utils/colours.ts delete mode 100644 pac-man-board-game/ClientApp/tests/utils/colours.test.ts diff --git a/pac-man-board-game/ClientApp/src/components/gameTile.tsx b/pac-man-board-game/ClientApp/src/components/gameTile.tsx index 9bfd35c..e24590c 100644 --- a/pac-man-board-game/ClientApp/src/components/gameTile.tsx +++ b/pac-man-board-game/ClientApp/src/components/gameTile.tsx @@ -2,7 +2,6 @@ import React, {useEffect, useState} from "react"; import {TileType} from "../game/tileType"; import {Character, Dummy} from "../game/character"; import {Direction} from "../game/direction"; -import {getBgCSSColour} from "../utils/colours"; import {Colour} from "../game/colour"; interface TileWithCharacterProps extends ComponentProps { @@ -51,7 +50,8 @@ export const GameTile: Component = ( const Circle: Component<{ colour?: Colour } & ComponentProps> = ({colour = Colour.White, className}) => (
-
+
); diff --git a/pac-man-board-game/ClientApp/src/utils/colours.ts b/pac-man-board-game/ClientApp/src/utils/colours.ts deleted file mode 100644 index edd3ec0..0000000 --- a/pac-man-board-game/ClientApp/src/utils/colours.ts +++ /dev/null @@ -1,10 +0,0 @@ -import {Colour} from "../game/colour"; - -/** - * Converts the given enum Colour to a Tailwind CSS class name. - * @param colour The colour to convert - * @returns The Tailwind CSS class name - */ -export function getBgCSSColour(colour: Colour): string { - return `bg-${colour}${colour !== Colour.White ? "-500" : ""}`; -} diff --git a/pac-man-board-game/ClientApp/tests/utils/colours.test.ts b/pac-man-board-game/ClientApp/tests/utils/colours.test.ts deleted file mode 100644 index 2e1bf1e..0000000 --- a/pac-man-board-game/ClientApp/tests/utils/colours.test.ts +++ /dev/null @@ -1,18 +0,0 @@ -import {expect, test} from "vitest" -import {getBgCSSColour} from "../../src/utils/colours"; -import {Colour} from "../../src/game/colour"; - -test('white should not use -500', () => { - const cssColour = getBgCSSColour(Colour.White); - expect(cssColour).toBe("bg-white"); -}); - -test('purple should use -500', () => { - const cssColour = getBgCSSColour(Colour.Purple); - expect(cssColour).toBe("bg-purple-500"); -}); - -test("yellow should use -500", () => { - const cssColour = getBgCSSColour(Colour.Yellow); - expect(cssColour).toBe("bg-yellow-500"); -}); diff --git a/pac-man-board-game/pac-man-board-game.csproj b/pac-man-board-game/pac-man-board-game.csproj index b3e6af1..f00e90c 100644 --- a/pac-man-board-game/pac-man-board-game.csproj +++ b/pac-man-board-game/pac-man-board-game.csproj @@ -46,6 +46,11 @@ + + + + +