Skip to content

Commit

Permalink
Merge pull request #12 from Polynomeer/feature/6/game-view
Browse files Browse the repository at this point in the history
Feature/6/game view
  • Loading branch information
swing-park authored May 7, 2021
2 parents d9bfcac + 49376de commit 152e914
Show file tree
Hide file tree
Showing 14 changed files with 239 additions and 21 deletions.
14 changes: 8 additions & 6 deletions FE/baseball/src/Components/Game/Game.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import GameHeader from './GameHeader/GameHeader';
import GamePlayground from './GamePlayground/GamePlayground';
import GamePlayLog from './GamePlayLog/GamePlayLog';
import { Game as S } from '@/Components/Game/GameStyles';
import ScoreBoard from './ScoreBoard/ScoreBoard';
import GameHeader from "./GameHeader/GameHeader";
import GamePlayground from "./GamePlayground/GamePlayground";
import GamePlayLog from "./GamePlayLog/GamePlayLog";
import SquadBoard from "./SquadBoard/SquadBoard";
import ScoreBoard from "./ScoreBoard/ScoreBoard";
import { Game as S } from "@/Components/Game/GameStyles";

const Game = () => {
const backgroundUrl =
'https://upload.wikimedia.org/wikipedia/commons/8/80/Munhak_baseball_stadium_2012.png';
"https://upload.wikimedia.org/wikipedia/commons/8/80/Munhak_baseball_stadium_2012.png";
return (
<>
<S.Background src={backgroundUrl} />
Expand All @@ -19,6 +20,7 @@ const Game = () => {
<S.GameRightSection>
<GamePlayLog />
</S.GameRightSection>
<SquadBoard />
</S.Game>
</>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { GamePlayground as S } from "@/Components/Game/GameStyles";

const GameDisplay = () => {
return <S.GameDisplay>GameDisplay</S.GameDisplay>;
// GameDisplay넣어야함
return <S.GameDisplay></S.GameDisplay>;
};

export default GameDisplay;
105 changes: 91 additions & 14 deletions FE/baseball/src/Components/Game/GameStyles.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import styled from 'styled-components';
import * as CS from '@/Styles/CommonStyles';
import theme from '@/Styles/theme';
import styled from "styled-components";
import * as CS from "@/Styles/CommonStyles";
import theme from "@/Styles/theme";

const Game = {
Game: styled(CS.BOX.FLEX_ROW_BOX)`
border: 3px solid #fff;
position: relative;
border: 3px solid ${theme.COLOR.DEFAULT};
background: #111;
opacity: 0.8;
width: 1440px;
Expand Down Expand Up @@ -106,11 +107,11 @@ const GamePlayground = {
left: 44%;
width: 150px;
outline: none;
border: 2px solid #fff;
border: 2px solid ${theme.COLOR.DEFAULT};
border-radius: 8px;
background: #222;
color: #fff;
font-family: 'Orbitron', sans-serif;
color: ${theme.COLOR.DEFAULT};
font-family: "Orbitron", sans-serif;
font-size: ${theme.FONTSIZE.M};
padding: 10px;
`,
Expand Down Expand Up @@ -141,11 +142,11 @@ const GamePlayground = {
margin-right: 3px;
background: ${({ type }) => {
switch (type) {
case 'STRIKE':
case "STRIKE":
return theme.COLOR.BALLCOUNT_STRIKE;
case 'BALL':
case "BALL":
return theme.COLOR.BALLCOUNT_BALL;
case 'OUT':
case "OUT":
return theme.COLOR.BALLCOUNT_OUT;
default:
return;
Expand Down Expand Up @@ -190,7 +191,7 @@ const GamePlayLog = {
LogTitle: styled.div`
font-weight: 600;
color: ${({ isCurrentPlayer }) =>
isCurrentPlayer ? 'red' : theme.COLOR.PLAYER_NAME};
isCurrentPlayer ? "red" : theme.COLOR.PLAYER_NAME};
`,
Log: styled.div`
padding: 20px 0px;
Expand All @@ -204,20 +205,96 @@ const GamePlayLog = {
border: 2px solid #222;
border-radius: 50%;
color: #222;
background: #fff;
background: ${theme.COLOR.DEFAULT};
text-align: center;
margin-right: 20px;
`,
LogRowAction: styled.div`
margin-right: 40px;
font-weight: 700;
color: ${({ isEndAction }) =>
isEndAction ? theme.COLOR.LOG_END_ACTION : '#fff'};
isEndAction ? theme.COLOR.LOG_END_ACTION : theme.COLOR.DEFAULT};
`,
LogRowBallCount: styled.div`
color: ${theme.COLOR.LOG_BALLCOUNT};
`,
},
};

export { Game, GameHeader, GamePlayground, GamePlayLog };
const SquadBoard = {
SquadBoard: styled(CS.BOX.FLEX_ROW_BOX)`
position: absolute;
bottom: ${({ isMouseOver }) => (isMouseOver ? "0px" : "-1080px")};
left: 5%;
width: 70%;
height: 77%;
background: #222;
padding: 30px;
z-index: 999;
border-radius: 8px;
border: 3px solid ${theme.COLOR.DEFAULT};
transition: all 1s;
`,
SquadBoardWrapper: styled.div`
position: absolute;
top: 0;
left: 0;
width: 1440px;
height: 1080px;
overflow: hidden;
`,
PopUpBackground: styled.div`
position: absolute;
display: ${({ isMouseOver }) => (isMouseOver ? "block" : "none")};
left: 0;
width: 100%;
height: 100%;
background: #222;
opacity: 0.7;
transition: all 1s;
`,
PopUpButton: styled.div`
width: 100px;
height: 20px;
border-radius: 50% 50% 0px 0px;
position: absolute;
bottom: 0%;
left: 530px;
background: gray;
opacity: 0.5;
text-align: center;
padding: 3px;
&:hover {
opacity: 0.7;
}
`,
SquadTable: {
SquadTable: styled.div`
padding: 20px;
border-radius: 8px;
border: 3px solid ${theme.COLOR.DEFAULT};
width: 45%;
margin: 0px 30px;
`,
SquadTableHeader: styled.div`
font-size: ${theme.FONTSIZE.S};
font-weight: 700;
text-align: center;
border-bottom: 3px solid ${theme.COLOR.DEFAULT};
padding-bottom: 10px;
`,
SquadTableBody: styled.table`
width: 100%;
height: 95%;
`,
SquadTableRow: styled.tr`
border-bottom: 1px solid ${theme.COLOR.PLAYER_DESCRIPTION};
text-align: center;
`,
SquadTableData: styled.td`
vertical-align: middle;
`,
},
};

export { Game, GameHeader, GamePlayground, GamePlayLog, SquadBoard };
21 changes: 21 additions & 0 deletions FE/baseball/src/Components/Game/SquadBoard/PopUpButton.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { SquadBoard as S } from "@/Components/Game/GameStyles";

const PopUpButton = ({ handleMouseOver }) => {
return (
<S.PopUpButton onMouseOver={handleMouseOver}>
<svg
x="0px"
y="0px"
width="15px"
height="15px"
viewBox="0 0 284.929 284.929"
fill="#fff"
>
<path d="M17.128,167.872c1.903,1.902,4.093,2.854,6.567,2.854c2.474,0,4.664-0.952,6.567-2.854L142.466,55.666l112.208,112.206 c1.902,1.902,4.093,2.854,6.563,2.854c2.478,0,4.668-0.952,6.57-2.854l14.274-14.277c1.902-1.902,2.847-4.093,2.847-6.563 c0-2.475-0.951-4.665-2.847-6.567L149.028,7.419c-1.901-1.906-4.088-2.853-6.562-2.853s-4.665,0.95-6.567,2.853L2.856,140.464 C0.95,142.367,0,144.554,0,147.034c0,2.468,0.953,4.658,2.856,6.561L17.128,167.872z" />
<path d="M149.028,117.055c-1.901-1.906-4.088-2.856-6.562-2.856s-4.665,0.953-6.567,2.856L2.856,250.1 C0.95,252.003,0,254.192,0,256.67c0,2.472,0.953,4.661,2.856,6.564l14.272,14.276c1.903,1.903,4.093,2.848,6.567,2.848 c2.474,0,4.664-0.951,6.567-2.848l112.204-112.209l112.208,112.209c1.902,1.903,4.093,2.852,6.563,2.852 c2.478,0,4.668-0.948,6.57-2.852l14.274-14.276c1.902-1.903,2.847-4.093,2.847-6.564c0-2.478-0.951-4.667-2.847-6.57 L149.028,117.055z" />
</svg>
</S.PopUpButton>
);
};

export default PopUpButton;
31 changes: 31 additions & 0 deletions FE/baseball/src/Components/Game/SquadBoard/SquadBoard.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { useState } from "react";
import PopUpButton from "./PopUpButton";
import SquadTable from "./SquadTable/SquadTable";
import { SquadBoard as S } from "@/Components/Game/GameStyles";

const SquadBoard = () => {
const [mouseOverFlag, setMouseOverFlag] = useState(false);

const handleMouseOver = ({ target: { tagName } }) => {
if (tagName === "path" || tagName === "svg") return;
setMouseOverFlag((prev) => !prev);
};

return (
<>
<S.SquadBoardWrapper>
<S.PopUpBackground
isMouseOver={mouseOverFlag}
onMouseOver={handleMouseOver}
/>
<PopUpButton handleMouseOver={handleMouseOver} />
<S.SquadBoard isMouseOver={mouseOverFlag}>
<SquadTable />
<SquadTable />
</S.SquadBoard>
</S.SquadBoardWrapper>
</>
);
};

export default SquadBoard;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import SquadTableHeader from "./SquadTableHeader";
import SquadTableBody from "./SquadTableBody";
import { SquadBoard as S } from "@/Components/Game/GameStyles";

const SquadTable = () => {
return (
<S.SquadTable.SquadTable>
<SquadTableHeader teamName={"TEAM - ILLY"} />
<SquadTableBody />
</S.SquadTable.SquadTable>
);
};

export default SquadTable;
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import SquadTableRow from "./SquadTableRow";
import { SquadBoard as S } from "@/Components/Game/GameStyles";

const SquadTableBody = ({ playerInfo }) => {
const rowHeaderDefault = {
타자: "타자",
타석: "타석",
안타: "안타",
아웃: "아웃",
평균: "평균",
};
const mockRow = {
타자: "스윙",
타석: "1",
안타: "2",
아웃: "2",
평균: "1.000",
};
return (
<S.SquadTable.SquadTableBody>
<tbody>
<SquadTableRow row={rowHeaderDefault} />
<SquadTableRow row={mockRow} />
<SquadTableRow row={mockRow} />
<SquadTableRow row={mockRow} />
<SquadTableRow row={mockRow} />
<SquadTableRow row={mockRow} />
<SquadTableRow row={mockRow} />
<SquadTableRow row={mockRow} />
<SquadTableRow row={mockRow} />
<SquadTableRow row={mockRow} />
<SquadTableRow row={mockRow} />
</tbody>
</S.SquadTable.SquadTableBody>
);
};

export default SquadTableBody;
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { SquadBoard as S } from "@/Components/Game/GameStyles";

const SquadTableData = ({ data }) => {
return <S.SquadTable.SquadTableData>{data}</S.SquadTable.SquadTableData>;
};

export default SquadTableData;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { SquadBoard as S } from "@/Components/Game/GameStyles";

const SquadTableHeader = ({ teamName }) => {
return (
<S.SquadTable.SquadTableHeader>{teamName}</S.SquadTable.SquadTableHeader>
);
};

export default SquadTableHeader;
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import SquadTableData from "./SquadTableData";
import { SquadBoard as S } from "@/Components/Game/GameStyles";

const SquadTableRow = ({ row }) => {
return row ? (
<S.SquadTable.SquadTableRow>
<SquadTableData data={row.타자} />
<SquadTableData data={row.타석} />
<SquadTableData data={row.안타} />
<SquadTableData data={row.아웃} />
<SquadTableData data={row.평균} />
</S.SquadTable.SquadTableRow>
) : null;
};

export default SquadTableRow;
2 changes: 2 additions & 0 deletions FE/baseball/src/Styles/GlobalStyles.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const GlobalStyles = createGlobalStyle`
display: flex;
justify-content: center;
align-items: center;
}
.App {
width:1440px;
Expand All @@ -28,6 +29,7 @@ const GlobalStyles = createGlobalStyle`
flex-direction:column;
justify-content: center;
align-items: center;
}
`;

export default GlobalStyles;

0 comments on commit 152e914

Please sign in to comment.