Skip to content

Commit

Permalink
Merge pull request #26 from Gui25Reis/feat/game-room
Browse files Browse the repository at this point in the history
Added new Features
  • Loading branch information
Vitor Grechi Kuninari authored Nov 19, 2021
2 parents 6161867 + 8a0f150 commit dd75529
Show file tree
Hide file tree
Showing 29 changed files with 488 additions and 1,075 deletions.
2 changes: 1 addition & 1 deletion src/assets/Background/fundo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/cardBack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/catapimba.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/assets/mesa.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/MiniCard.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import '../styles/minicard.css';
import '../sass/app.css'

const MiniCard = (props) => {
return(
Expand Down
2 changes: 1 addition & 1 deletion src/components/card.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import '../styles/card.css';
import '../sass/app.css'

const Card = (props) => {
return(
Expand Down
55 changes: 46 additions & 9 deletions src/components/player.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React, { useState } from 'react';

import '../styles/player.css';
import '../sass/app.css'
import playerCard from '../assets/Usuario/Usuario.png';
import cardBack from '../assets/cardBack.png';

const Player = (props) => {
const [numbers] = useState(Array(props.life).fill("❤️"))
const [usePlayer] = useState(props.player)

const listItems = () => {
if(numbers.length === 0){
Expand All @@ -18,16 +20,51 @@ const Player = (props) => {
<div className="playerslives" id="life">
{numbers.map((life, index) => <p key={index}> {life} </p>)}
</div>
);
);
}

const playerOff = (param) => {
return(
<div className="playerOffline" >
{/* <p className="playerNameOff">{param.name}</p> */}
<div className="playerProfileOff" >
<img
className="playerImageOff"
src={playerCard}
alt="imagem dos jogadores"
draggable="false"
>
</img>
</div>
{/* {listItems()} */}
</div>
)
}


const playerOn = (param) => {
return(
<div className="player" >
<p className="playerName">{param.name}</p>
<div className="playerProfile" >
<img
className="playerImage"
src={playerCard}
alt="imagem dos jogadores"
draggable="false"
style={param.host === true ? {borderColor: "#41d4b0"} : {borderColor: "#1c0c16"}}>
</img>
<div className="cardsNumbers">
<img className="cardsBack" src={cardBack} alt="costas da carta" draggable="false"></img>
<p>{param.cards === undefined ? "0" : param.cards}</p>
</div>
</div>
{listItems()}
</div>
)
}
return (
<div className="player" >
<p>{props.name}</p>
<img src={playerCard} alt="imagem dos jogadores" draggable="false"></img>
{listItems()}

</div>

usePlayer ? playerOn(props) : playerOff(props)
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/game/Create.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function Create() {
</div>
</div>
<div className="menuButtons">
<Link to="/menu">
<Link to="/">
<button className="back">Voltar</button>
</Link>

Expand Down
8 changes: 4 additions & 4 deletions src/game/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from 'react-router-dom';

import '../sass/app.css'
import "../styles/fonts.css";
// import "../styles/fonts.css";

const Menu = () => {
const [isNameFocused, setIsNameFocused] = useState(false);
Expand Down Expand Up @@ -61,7 +61,7 @@ const Menu = () => {
onBlur={handleInputBlur}
onInput={handleInputChange}
onKeyDownCapture={handleKeyDown}
style = {isNameFocused ? {backgroundColor: "#83bfe2"} : {}}
style = {isNameFocused ? {backgroundColor: '#e1c78e'} : {}}
/>
<div id="rooms">
<Link to="/create">
Expand All @@ -85,14 +85,14 @@ const Menu = () => {
onBlur={handleInputBlur}
onInput={handleInputChange}
onKeyDownCapture={handleKeyDown}
style = {isCodeFocused ? {backgroundColor: "#83bfe2"} : {}}
style = {isCodeFocused ? {backgroundColor: "#e1c78e"} : {}}
/>
<Link to={code === 5 && name > 0 ? "/game" : '#'}>
<input
type="submit"
id = "pointerButton"
value = "➜"
style = {code === 5 ? {cursor: 'pointer', color: "#000", fontWeight: "bold"} : {color: "#757575"}}
style = {code === 5 ? {cursor: 'pointer', color: "#000", fontWeight: "#1c0c16"} : {color: "#757575"}}
>
</input>
</Link>
Expand Down
20 changes: 10 additions & 10 deletions src/game/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,34 +169,34 @@ const Game = () => {
</div>

<div id="player0">
<Player name="NomeDoJogador" life={3} />
<Player player={true} host={true} name="NomeDoJogador" life={3} cards="4" />
</div>
<div id="player1">
<Player name="NomeDoJogador" life={3} />
<Player player={true} name="NomeDoJogador" life={3} cards="5" />
</div>
<div id="player2">
<Player name="NomeDoJogador" life={3} />
<Player player={true} name="NomeDoJogador" life={3} cards="4" />
</div>
<div id="player3">
<Player name="NomeDoJogador" life={3} />
<Player player={true} name="NomeDoJogador" life={3} cards="4" />
</div>
<div id="player4">
<Player name="NomeDoJogador" life={3} />
<Player player={true} name="NomeDoJogador" life={3} cards="4" />
</div>
<div id="player5">
<Player name="NomeDoJogador" life={3} />
<Player player={true} name="NomeDoJogador" life={3} cards="4" />
</div>
<div id="player6">
<Player name="NomeDoJogador" life={3} />
<Player player={true} name="NomeDoJogador" life={3} cards="3" />
</div>
<div id="player7">
<Player name="NomeDoJogador" life={3} />
<Player player={false} name="NomeDoJogador" life={3} cards="3" />
</div>
<div id="player8">
<Player name="NomeDoJogador" life={3} />
<Player player={true} name="NomeDoJogador" life={3} cards="4" />
</div>
<div id="player9">
<Player name="NomeDoJogaddor" life={3} />
<Player player={true} name="NomeDoJogaddor" life={3} cards="4" />
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
Route,
} from 'react-router-dom';

import './styles/index.css';
// import './styles/index.css';

import Create from './game/Create.js'
import Menu from './game/Menu.js';
Expand Down
Loading

0 comments on commit dd75529

Please sign in to comment.