Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] 게임화면 및 대기화면 기능 구현 #54

Merged
merged 10 commits into from
Jul 24, 2024
2 changes: 1 addition & 1 deletion frontend/src/components/GameResult/GameResult.styled.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { css } from '@emotion/react';

export const layout = css`
export const gameResultLayout = css`
display: flex;
flex-direction: column;
justify-content: center;
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/GameResult/GameResult.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useNavigate } from 'react-router-dom';

import { gameResultTitle, gameResultTitleWrapper, layout } from './GameResult.styled';
import { gameResultTitle, gameResultTitleWrapper, gameResultLayout } from './GameResult.styled';

import Button from '@/components/common/Button/Button';

Expand All @@ -12,7 +12,7 @@ const GameResult = () => {
};

return (
<div css={layout}>
<div css={gameResultLayout}>
<div css={gameResultTitleWrapper}>
<h1 css={gameResultTitle}>게임 결과</h1>
</div>
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/NicknameList/NicknameList.styled.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { css } from '@emotion/react';

export const layout = css`
export const nicknameListLayout = css`
display: flex;
justify-content: space-around;
width: 24.5rem;
height: 15.4rem;
width: 24.4rem;
height: 15.8rem;
`;

export const nicknameContainer = css`
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/NicknameList/NicknameList.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { layout, nicknameContainer, verticalLine } from './NicknameList.styled';
import { nicknameListLayout, nicknameContainer, verticalLine } from './NicknameList.styled';

const NicknameList = () => {
const optionANicknames = ['철수', '철수', '철수', '철수', '철수', '철수', '철수', '철수', '철수'];
const optionBNicknames = ['영미', '영미', '영미'];

return (
<div css={layout}>
<div css={nicknameListLayout}>
<div css={nicknameContainer}>
{optionANicknames.map((optionANickname) => (
<span key={optionANickname}>{optionANickname}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import { css } from '@emotion/react';

import { Theme } from '@/styles/Theme';

interface LayoutProps {
interface RoundVoteResultLayoutProps {
percentage: number;
}

export const layout = ({ percentage }: LayoutProps) => css`
export const roundVoteResultLayout = ({ percentage }: RoundVoteResultLayoutProps) => css`
display: flex;
justify-content: space-around;
align-items: center;
width: 24.5rem;
height: 11rem;
width: 24rem;
height: 11.6rem;

font-size: 1.2rem;
background: linear-gradient(
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/RoundVoteResult/RoundVoteResult.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { layout, fontBold, voteContent } from './RoundVoteResult.styled';
import { roundVoteResultLayout, fontBold, voteContent } from './RoundVoteResult.styled';

import useBalanceContentQuery from '@/hooks/useBalanceContentQuery';

const RoundVoteResult = () => {
const { balanceContent } = useBalanceContentQuery();

return (
<div css={layout({ percentage: 72 })}>
<div css={roundVoteResultLayout({ percentage: 72 })}>
<div css={voteContent}>
<div css={fontBold}>{balanceContent?.firstOption.name}</div>
<div css={fontBold}>72%</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { css } from '@emotion/react';

export const layout = css`
export const selectContainerLayout = css`
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 5rem;
gap: 4rem;
flex-basis: 55%;
`;

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/SelectContainer/SelectContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from 'react';
import { useNavigate } from 'react-router-dom';

import { layout, selectSection } from './SelectContainer.styled';
import { selectContainerLayout, selectSection } from './SelectContainer.styled';

import Button from '@/components/common/Button/Button';
import SelectOption from '@/components/SelectOption/SelectOption';
Expand All @@ -25,7 +25,7 @@ const SelectContainer = () => {
return (
<>
{balanceContent && (
<div css={layout}>
<div css={selectContainerLayout}>
<section css={selectSection}>
<SelectOption
option={balanceContent.firstOption}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/SelectOption/SelectOption.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { css } from '@emotion/react';

import { Theme } from '@/styles/Theme';

export const layout = (selected: boolean) => css`
export const SelectOptionLayout = (selected: boolean) => css`
display: flex;
justify-content: center;
align-items: center;
width: 11.4rem;
width: 11.6rem;
height: 16.8rem;
padding: 1.6rem;

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/SelectOption/SelectOption.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { layout } from './SelectOption.styled';
import { SelectOptionLayout } from './SelectOption.styled';

import { BalanceContent } from '@/types/balanceContent';

Expand All @@ -11,7 +11,7 @@ interface SelectOptionProps {
const SelectOption = ({ option, selectedId, handleSelectOption }: SelectOptionProps) => {
return (
<button
css={layout(Boolean(selectedId === option.optionId))}
css={SelectOptionLayout(Boolean(selectedId === option.optionId))}
onClick={() => handleSelectOption(option.optionId)}
>
{option.name}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Timer/Timer.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { css } from '@emotion/react';

import { Theme } from '@/styles/Theme';

export const layout = css`
export const timerLayout = css`
display: flex;
justify-content: center;
width: 100%;
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Timer/Timer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { layout } from './Timer.styled';
import { timerLayout } from './Timer.styled';

const Timer = () => {
return <div css={layout}></div>;
return <div css={timerLayout}></div>;
};

export default Timer;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { css } from '@emotion/react';

export const topicLayout = css`
export const topicContainerLayout = css`
display: flex;
flex-direction: column;
justify-content: center;
Expand All @@ -11,7 +11,7 @@ export const topicLayout = css`

export const categoryText = css`
font-weight: bold;
font-size: 1.4rem;
font-size: 1.2rem;
`;

export const topicText = css`
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/TopicContainer/TopicContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { categoryText, topicLayout, topicText } from './TopicContainer.styled';
import { categoryText, topicContainerLayout, topicText } from './TopicContainer.styled';

import useBalanceContentQuery from '@/hooks/useBalanceContentQuery';

const TopicContainer = () => {
const { balanceContent } = useBalanceContentQuery();

return (
<section css={topicLayout}>
<section css={topicContainerLayout}>
<span css={categoryText}>{balanceContent?.category}</span>
<span css={topicText}>{balanceContent?.question}</span>
</section>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/common/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { buttonLayout } from './Button.styled';

interface ButtonProps {
text: '선택' | '확인' | '다음';
text: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L5 - 참고 의견

저도 수정하면서 좀 고민이 되었는데 버튼 내의 텍스트는 그냥 string으로 열어둬도 괜찮을 것 같긴 하네용

active: boolean;
onClick: () => void;
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/layout/Content/Content.styled.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { css } from '@emotion/react';

export const contentSection = css`
export const contentLayout = css`
display: flex;
flex-direction: column;
align-items: center;
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/layout/Content/Content.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { PropsWithChildren } from 'react';

import { contentSection } from './Content.styled';
import { contentLayout } from './Content.styled';

const Content = ({ children }: PropsWithChildren) => {
return <section css={contentSection}>{children}</section>;
return <section css={contentLayout}>{children}</section>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L5 - 참고 의견

layout 명 고치느라 고생많았네요!!! 컨벤션 지키려고 노력하는 거 아주 좋습니당

};

export default Content;
1 change: 1 addition & 0 deletions frontend/src/components/layout/Header/Header.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const headerLayout = css`
display: flex;
justify-content: space-between;
align-items: center;
height: 8rem;
`;

export const gameTitle = css`
Expand Down
30 changes: 30 additions & 0 deletions frontend/src/pages/MainPage/MainPage.styled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { css } from '@emotion/react';

import { Theme } from '@/styles/Theme';

export const mainPageLayout = css`
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100%;

background-color: ${Theme.color.peanut200};
gap: 3rem;
`;

export const logoWrapper = css`
width: 16rem;
height: 16rem;

background-color: white;
`;

export const title = css`
font-size: 4.8rem;
`;

export const intro = css`
color: ${Theme.color.gray400};
font-size: 1.6rem;
`;
24 changes: 24 additions & 0 deletions frontend/src/pages/MainPage/MainPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { useNavigate } from 'react-router-dom';

import { mainPageLayout, logoWrapper, title, intro } from './MainPage.styled';

import Button from '@/components/common/Button/Button';

const MainPage = () => {
const navigate = useNavigate();

const goToNicknamePage = () => {
navigate('/nickname');
};

return (
<div css={mainPageLayout}>
<div css={logoWrapper}>LO to the GO</div>
<h1 css={title}>땅콩</h1>
<h2 css={intro}>어색한 분위기를 주도해봐요</h2>
<Button text="방 만들기" active={true} onClick={goToNicknamePage}></Button>
</div>
);
};

export default MainPage;
39 changes: 39 additions & 0 deletions frontend/src/pages/NicknamePage/NicknamePage.styled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { css } from '@emotion/react';

import { Theme } from '@/styles/Theme';

export const profile = css`
width: 8rem;
height: 8rem;
margin-top: 4rem;

background-color: ${Theme.color.gray300};
border-radius: 50%;
`;

export const nickname = css`
width: 26.8rem;
margin: 2rem 0;

font-weight: 600;
font-size: 1.6rem;
`;

export const nicknameInputWrapper = css`
display: flex;
align-items: center;
width: 26.8rem;
height: 4.8rem;
padding: 0 1rem;

background-color: ${Theme.color.gray200};
border-radius: 1rem;
`;

export const nicknameInput = css`
width: 100%;
border: 0;

background-color: ${Theme.color.gray200};
outline: none;
`;
20 changes: 20 additions & 0 deletions frontend/src/pages/NicknamePage/NicknamePage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { profile, nickname, nicknameInputWrapper, nicknameInput } from './NicknamePage.styled';

import Content from '@/components/layout/Content/Content';
import { createRandomNickname } from '@/utils/nickname';

const NicknamePage = () => {
const randomNickname = createRandomNickname();

return (
<Content>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L5 - 참고 의견

알아서 찰떡 같이 공통 Content layout 잘 적용하신 모습을 보니 뿌듯하네요 ✨

<div css={profile}></div>
<div css={nickname}>닉네임</div>
<div css={nicknameInputWrapper}>
<input css={nicknameInput} type="text" placeholder={randomNickname} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L4 - 변경 제안

저희 근데 어차피 지금은 닉네임을 변경할 수 없으니 placeholder로 안 하고 value에 넣어도 되지 않을까 하는 생각도 있는데, 어떻게 생각하시나요 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value랑 placeholder 둘 다 변경이 가능해서 기능 상의 차이는 없지 않을까 생각합니다!

</div>
</Content>
);
};

export default NicknamePage;
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import { css } from '@emotion/react';

export const NicknameListWrapper = css`
margin-top: 1.6rem;
margin-bottom: 0.7rem;
margin-bottom: 0.8rem;
`;
Loading