diff --git a/client/src/App.css b/client/src/App.css index 2545e94..1b8eb84 100644 --- a/client/src/App.css +++ b/client/src/App.css @@ -2,9 +2,109 @@ text-align: center; } -.card { - border: 1px solid black; - padding: 20px; - margin: 20px; +a { + color: white; +} + +.Game { + background-size: cover; + margin: 0; + height: 100vh; +} + +.backgroundColor0 { + background-image: url('./assets/backgrounds/bg0.png'); +} + +.backgroundColor1 { + background-image: url('./assets/backgrounds/bg1.png'); +} + +.backgroundColor2 { + background-image: url('./assets/backgrounds/bg2.png'); +} + +.backgroundColor3 { + background-image: url('./assets/backgrounds/bg3.png'); +} + +.backgroundColor4 { + background-image: url('./assets/backgrounds/bg4.png'); +} + +.Card { + width: 6rem; + margin: 2px; + cursor: pointer; +} + +.topInfo { + display: flex; + flex-direction: row; + justify-content: space-between; + padding: 0 60px; +} + +.topInfo>h1 { + color: white; + margin-top: 10px; + font-size: 1.8rem; +} + +.square { + height: 20px; + width: 20px; display: inline-block; + margin: 20px 2px; + cursor: pointer; + border-radius: 10%; +} + +.color0 { + background-color: #8e251d; +} + +.color1 { + background-color: #48406a; +} + +.color2 { + background-color: #406a4b; +} + +.color3 { + background-color: #40686a; +} + +.color4 { + background-color: #23873f; +} + +.topInfoText { + color: white; + font-size: 2rem; + margin: 0; +} + +.waitingForPlayer { + height: 80px; + font-size: 1.5rem; +} + +.player1Deck>img { + transition: transform 350ms; +} + +.player1Deck>img:hover { + transform: scale(1.08); + opacity: 1; +} + +.player2Deck>img { + transition: transform 350ms; +} + +.player2Deck>img:hover { + transform: scale(1.08); + opacity: 1; } \ No newline at end of file diff --git a/client/src/assets/backgrounds/bg0.png b/client/src/assets/backgrounds/bg0.png new file mode 100644 index 0000000..749b7b3 Binary files /dev/null and b/client/src/assets/backgrounds/bg0.png differ diff --git a/client/src/assets/backgrounds/bg1.png b/client/src/assets/backgrounds/bg1.png new file mode 100644 index 0000000..60522bf Binary files /dev/null and b/client/src/assets/backgrounds/bg1.png differ diff --git a/client/src/assets/backgrounds/bg2.png b/client/src/assets/backgrounds/bg2.png new file mode 100644 index 0000000..37ffb1b Binary files /dev/null and b/client/src/assets/backgrounds/bg2.png differ diff --git a/client/src/assets/backgrounds/bg3.png b/client/src/assets/backgrounds/bg3.png new file mode 100644 index 0000000..498ac74 Binary files /dev/null and b/client/src/assets/backgrounds/bg3.png differ diff --git a/client/src/assets/backgrounds/bg4.png b/client/src/assets/backgrounds/bg4.png new file mode 100644 index 0000000..66d06d9 Binary files /dev/null and b/client/src/assets/backgrounds/bg4.png differ diff --git a/client/src/components/Game.js b/client/src/components/Game.js index f755a09..f846a9f 100644 --- a/client/src/components/Game.js +++ b/client/src/components/Game.js @@ -31,7 +31,6 @@ const Game = (props) => { "transports" : ["websocket"] } socket = io.connect(ENDPOINT, connectionOptions) - console.log(socket); socket.emit('join', {room: room}, (error) => { if(error) @@ -143,7 +142,18 @@ const Game = (props) => { const checkWinner = (arr, player) => { return arr.length === 1 ? player : '' } - + + const changeBackgroundColor = (id) => { + const backgroundColorIds = [0, 1, 2, 3, 4] + const newBackgroundColorIds = backgroundColorIds.filter(item => item!=id) + const gameDiv = document.querySelector('.Game') + newBackgroundColorIds.forEach(item => { + gameDiv.classList.remove(`backgroundColor${item}`) + }) + gameDiv.classList.add(`backgroundColor${id}`) + } + + //driver functions const onCardPlayedHandler = (played_card) => { //extract player who played the card const cardPlayedBy = turn @@ -703,91 +713,99 @@ const Game = (props) => { } return ( - <> +