import { Popup } from 'react-map-gl/maplibre'; import type { Port } from '../../data/ports'; const COUNTRY_STYLE: Record = { KR: { color: '#3b82f6', flag: '🇰🇷', label: '한국' }, CN: { color: '#ef4444', flag: '🇨🇳', label: '중국' }, JP: { color: '#f472b6', flag: '🇯🇵', label: '일본' }, KP: { color: '#f97316', flag: '🇰🇵', label: '북한' }, TW: { color: '#10b981', flag: '🇹🇼', label: '대만' }, }; function getStyle(p: Port) { return COUNTRY_STYLE[p.country] || COUNTRY_STYLE.KR; } interface Props { selected: Port | null; onClose: () => void; } export function PortLayer({ selected, onClose }: Props) { if (!selected) return null; const s = getStyle(selected); return (
{s.flag} ⚓ {selected.nameKo}
{selected.type === 'major' ? '주요항만' : '항만'} {s.label}
항구 : {selected.nameKo}
영문 : {selected.name}
{selected.lat.toFixed(4)}°N, {selected.lng.toFixed(4)}°E
MarineTraffic →
); }