Skip to content

Commit

Permalink
feat: categoryContainer에 방 정보 추가 #274
Browse files Browse the repository at this point in the history
  • Loading branch information
novice0840 committed Sep 21, 2024
1 parent 35108bf commit a529007
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import getBorderRadius from '@/styles/utils/getBorderRadius';

export const categoryContainerLayout = css`
display: flex;
flex-direction: column;
justify-content: space-between;
justify-content: space-evenly;
align-items: center;
height: 10rem;
padding: 1.6rem 0 2.4rem;
Expand All @@ -16,11 +15,22 @@ export const categoryContainerLayout = css`
cursor: pointer;
`;

export const roomSettingBox = css`
display: flex;
flex-direction: column;
gap: 1rem;
`;

export const title = css`
font-weight: 800;
font-size: 2.8rem;
`;

export const subtitle = css`
font-weight: 800;
font-size: 2rem;
`;

export const roomSettingLabel = css`
font-weight: 600;
`;
28 changes: 24 additions & 4 deletions frontend/src/components/CategoryContainer/CategoryContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,38 @@
import { categoryContainerLayout, title, subtitle } from './CategoryContainer.styled';
import { useRecoilValue } from 'recoil';

import {
categoryContainerLayout,
title,
subtitle,
roomSettingLabel,
roomSettingBox,
} from './CategoryContainer.styled';
import RoomSettingModal from '../common/RoomSettingModal/RoomSettingModal';

import { useGetRoomInfo } from '@/hooks/useGetRoomInfo';
import useModal from '@/hooks/useModal';
import { memberInfoState } from '@/recoil/atom';

const CategoryContainer = () => {
const { roomSetting } = useGetRoomInfo();
const { isOpen, show, close } = useModal();
const { isMaster } = useRecoilValue(memberInfoState);

return (
<>
<button css={categoryContainerLayout} onClick={show}>
<span css={subtitle}>카테고리</span>
<h1 css={title}>{roomSetting.category.label}</h1>
<button css={categoryContainerLayout} onClick={isMaster ? show : () => {}}>
<div css={roomSettingBox}>
<span css={roomSettingLabel}>라운드</span>
<h1 css={subtitle}>{roomSetting.totalRound}</h1>
</div>
<div css={roomSettingBox}>
<span css={roomSettingLabel}>카테고리</span>
<h1 css={title}>{roomSetting.category.label}</h1>
</div>
<div css={roomSettingBox}>
<span css={roomSettingLabel}>타이머</span>
<h1 css={subtitle}>{roomSetting.timeLimit}</h1>
</div>
</button>
{isOpen && <RoomSettingModal isOpen={isOpen} onClose={close} />}
</>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/layout/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ export const RoomSettingHeader = ({ title }: HeaderProps) => {
const { isOpen, show, close } = useModal();
const { isOpen: isExitOpen, show: exitShow, close: exitClose } = useModal();
const { handleExit } = useExit();
const memberInfo = useRecoilValue(memberInfoState);
const { isMaster } = useRecoilValue(memberInfoState);

return (
<header css={headerLayout()}>
<button onClick={exitShow} css={buttonWrapper}>
<img src={ExitIcon} alt="방 설정" css={iconImage} />
</button>
<h1 css={gameTitle}>{title}</h1>
{memberInfo.isMaster ? (
{isMaster ? (
<button onClick={show} css={buttonWrapper}>
<img src={SettingIcon} alt="방 설정" css={iconImage} />
</button>
Expand Down

0 comments on commit a529007

Please sign in to comment.