"PC버전을 좀더" 요청. 1440×900·1280×720·1920×1080에서 찍어 보니 휴대폰용 한 줄 배치를 1,200px로 늘린 화면이 흩어져 보였고, PC 대기실의 자리 카드는 400px 칸에 두 개씩 들어가 이름이 한 글자씩 꺾였다. - 게임 소개·코드로 참여·규칙: PC는 가운데 768px 칸(뒤로 줄도 같은 폭). 게임 소개 뒤로 줄의 이름 중복 제거. 코드 입력칸은 최대 520px. - 설정(/me): PC는 1080px 두 칸(왼쪽 프로필·로그아웃, 오른쪽 화면 설정·기록). 휴대폰은 그대로, 로그아웃 맨 아래. - 홈: 큰 버튼 3개를 낮은 가로 카드로, "게임 고르기" 제목과 종류 탭을 한 줄로. 1440×900에서 26개가 한 화면. 게임 고르기 창은 PC에서 두 줄. - 대기실(PC): 왼쪽 넓은 칸에 초대(한 줄) → 자리(2명 방 2칸, 5명 넘으면 3칸) → [컴퓨터 넣기][관전으로 바꾸기] → 시작(가운데 420px) → 채팅, 오른쪽에 게임 설정. 태블릿·휴대폰 배치는 그대로. - 방 막대 버튼: 마우스 환경에서 40px(막대 안에 여유), 터치는 48px. - docs/07 §3.2~3.5 갱신. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
48 lines
2.0 KiB
TypeScript
48 lines
2.0 KiB
TypeScript
import { useState, type ReactNode } from 'react';
|
|
import { Link } from 'react-router';
|
|
import type { CatalogEntry } from '@bg/shared/lite';
|
|
import { GAME_GROUPS, GAME_ICON } from '../lib/catalog-ui';
|
|
|
|
/**
|
|
* Game picker (docs/07 §3.3): small tiles with icon, name and one meta line. The one-line blurb and
|
|
* difficulty live on the game page, so 26 games fit on a phone in a few screens. A tab row narrows the list.
|
|
*/
|
|
export function GameGrid({ games, heading }: { games: CatalogEntry[]; heading?: ReactNode }) {
|
|
const [group, setGroup] = useState<string>('all');
|
|
const groups = GAME_GROUPS.filter((g) => games.some((x) => g.ids.includes(x.id)));
|
|
const shown = group === 'all' ? games : games.filter((g) => GAME_GROUPS.find((x) => x.key === group)?.ids.includes(g.id));
|
|
return (
|
|
<div className="stack" style={{ gap: 14 }}>
|
|
{/* The heading and the tabs share one line on PC (wraps under it on phones). */}
|
|
<div className="game-grid-head">
|
|
{heading}
|
|
{groups.length > 1 && (
|
|
<div className="segmented game-tabs" role="group" aria-label="게임 종류">
|
|
<button type="button" aria-pressed={group === 'all'} onClick={() => setGroup('all')}>
|
|
전체
|
|
</button>
|
|
{groups.map((g) => (
|
|
<button key={g.key} type="button" aria-pressed={group === g.key} onClick={() => setGroup(g.key)}>
|
|
{g.label}
|
|
</button>
|
|
))}
|
|
</div>
|
|
)}
|
|
</div>
|
|
<div className="game-grid">
|
|
{shown.map((g) => (
|
|
<Link key={g.id} to={`/g/${g.id}`} className="card game-card">
|
|
<span className="game-card-icon" aria-hidden>
|
|
{GAME_ICON[g.id] ?? '🎲'}
|
|
</span>
|
|
<strong className="game-card-name">{g.nameKo}</strong>
|
|
<span className="game-card-meta">
|
|
{g.minPlayers === g.maxPlayers ? `${g.minPlayers}명` : `${g.minPlayers}~${g.maxPlayers}명`} · {g.minutes}분
|
|
</span>
|
|
</Link>
|
|
))}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|