From e861cceda0733c2e4b06f85c5be277e940b7c393 Mon Sep 17 00:00:00 2001 From: Mikayla Dobson Date: Sat, 16 Jul 2022 14:10:45 -0500 Subject: [PATCH] organizing type structure --- src/components/Card/Card.d.ts | 8 -------- src/components/Card/Card.tsx | 4 ++-- src/components/Gameboard/Gameboard.tsx | 10 +++------- src/util/main.d.ts | 22 ++++++++++++++++++++++ 4 files changed, 27 insertions(+), 17 deletions(-) delete mode 100644 src/components/Card/Card.d.ts create mode 100644 src/util/main.d.ts diff --git a/src/components/Card/Card.d.ts b/src/components/Card/Card.d.ts deleted file mode 100644 index cd284b4..0000000 --- a/src/components/Card/Card.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -declare namespace CardInfo { - export interface Card { - gemValue: string - tier: number - points?: number - cost: any - } -} \ No newline at end of file diff --git a/src/components/Card/Card.tsx b/src/components/Card/Card.tsx index e23f62f..1ce4d7b 100644 --- a/src/components/Card/Card.tsx +++ b/src/components/Card/Card.tsx @@ -1,6 +1,6 @@ -/// +/// -export default function Card(data: CardInfo.Card) { +export default function Card(data: Universals.Card) { return (

{data.gemValue}

diff --git a/src/components/Gameboard/Gameboard.tsx b/src/components/Gameboard/Gameboard.tsx index bbe1ee0..873be66 100644 --- a/src/components/Gameboard/Gameboard.tsx +++ b/src/components/Gameboard/Gameboard.tsx @@ -1,13 +1,9 @@ /// -/// - -import { useState, useEffect } from "react" +/// export default function Gameboard() { - const [cards, setCards] = useState(); - - const exampleCard: CardInfo.Card = { - gemValue: "ruby", + const exampleCard: Universals.Card = { + gemValue: Universals.GemValue.Ruby, tier: 1, cost: 5 } diff --git a/src/util/main.d.ts b/src/util/main.d.ts new file mode 100644 index 0000000..7a71dc9 --- /dev/null +++ b/src/util/main.d.ts @@ -0,0 +1,22 @@ +declare namespace Universals { + export interface Card { + gemValue: GemValue + tier: number + points?: number + cost: any + } + + export interface Nobles { + points: 3 + + } + + export enum GemValue { + Ruby, + Sapphire, + Emerald, + Diamond, + Onyx, + Gol, + } +} \ No newline at end of file