diff --git a/src/layout/components/Deck.tsx b/src/layout/components/Deck.tsx new file mode 100644 index 0000000..c43221e --- /dev/null +++ b/src/layout/components/Deck.tsx @@ -0,0 +1,29 @@ +import React, {FunctionComponent} from "react"; +import Card from "./Card"; + +interface Props { + currentCard: string; + actionOnClick: () => void; +} + +const Deck: FunctionComponent = ({currentCard, actionOnClick}) => { + + const handleClick = (card: string) => { + actionOnClick(); + } + + return ( +
+
+

+ +
+
+

+ +
+
+ ); +} + +export default Deck; diff --git a/src/layout/pages/Room.tsx b/src/layout/pages/Room.tsx index 1d13118..61fae34 100644 --- a/src/layout/pages/Room.tsx +++ b/src/layout/pages/Room.tsx @@ -5,6 +5,7 @@ import {GHButton} from "../components/Button"; import useTitle from "../../utils/TitleHook"; import Card from "../components/Card"; import Hand from "../components/Hand"; +import Deck from "../components/Deck"; interface GameState { PlayerName: string; @@ -39,8 +40,19 @@ const Room = () => { } const handleCardSend = (card: string) => { - const formattedCard = JSON.stringify({CardType: card.split(' ')[0], CardValue: card.split(' ')[1]}); - websocket.sendMessage(formattedCard); + const formattedAction = JSON.stringify({ + Action: "PLAYCARD", + Data: JSON.stringify({CardType: card.split(' ')[0], CardValue: card.split(' ')[1]}) + }); + websocket.sendMessage(formattedAction); + } + + const handleDraw = () => { + const formattedAction = JSON.stringify({ + Action: "DRAW", + Data: "" + }); + websocket.sendMessage(formattedAction); } return ( @@ -49,9 +61,12 @@ const Room = () => { Leave Room { gameState.CurrentCard && - + + } + { + gameState.Hand && + } -
    { gameState.Players.map((player, index) => { diff --git a/src/styles/layout/components/_components.scss b/src/styles/layout/components/_components.scss index c5a74b8..b053990 100644 --- a/src/styles/layout/components/_components.scss +++ b/src/styles/layout/components/_components.scss @@ -1,3 +1,4 @@ @import "button"; @import "card"; -@import "hand"; \ No newline at end of file +@import "hand"; +@import "deck"; \ No newline at end of file diff --git a/src/styles/layout/components/deck.scss b/src/styles/layout/components/deck.scss new file mode 100644 index 0000000..d021614 --- /dev/null +++ b/src/styles/layout/components/deck.scss @@ -0,0 +1,6 @@ +.deck-container { + display: flex; + flex-direction: row; + margin-left: 0.5rem; + gap: 0.5rem; +}