o2o-triple-pick/components/TeamFlag.tsx

47 lines
1.3 KiB
TypeScript

import type { Team } from "@/lib/types";
// 모든 경기에 일반화된 국기 렌더.
// KOR = 실제 png 자산, CZE = 인라인 SVG(기존 디자인 유지), 그 외 = 이모지 박스.
export default function TeamFlag({
team,
className = "",
}: {
team: Team;
className?: string;
}) {
if (team.code === "KOR") {
return (
<img
src="/icons/kor.png"
alt={team.name}
className={`flag-img object-cover ${className}`}
/>
);
}
if (team.code === "CZE") {
return (
<svg
viewBox="0 0 6 4"
className={`rounded-lg border border-[var(--line-d)] ${className}`}
preserveAspectRatio="none"
aria-label={team.name}
>
<rect width="6" height="2" y="0" fill="#ffffff" />
<rect width="6" height="2" y="2" fill="#d7141a" />
<polygon points="0,0 3,2 0,4" fill="#11457e" />
</svg>
);
}
// 그 외 국가 — 이모지 국기 (자산 추가 전 fallback)
return (
<span
className={`grid place-items-center overflow-hidden rounded-lg border border-[var(--line-d)] bg-white/[0.06] ${className}`}
aria-label={team.name}
>
<span className="leading-none" style={{ fontSize: "1.7em" }}>
{team.flag}
</span>
</span>
);
}