import { useState } from 'react'; import type { MapStyleSettings, MapLabelLanguage, DepthFontSize } from './types'; import { DEFAULT_MAP_STYLE_SETTINGS } from './types'; interface MapSettingsPanelProps { value: MapStyleSettings; onChange: (next: MapStyleSettings) => void; } const LANGUAGES: { value: MapLabelLanguage; label: string }[] = [ { value: 'ko', label: '한국어' }, { value: 'en', label: 'English' }, { value: 'ja', label: '日本語' }, { value: 'zh', label: '中文' }, { value: 'local', label: '현지어' }, ]; const FONT_SIZES: { value: DepthFontSize; label: string }[] = [ { value: 'small', label: '소' }, { value: 'medium', label: '중' }, { value: 'large', label: '대' }, ]; function depthLabel(depth: number): string { return `${Math.abs(depth).toLocaleString()}m`; } export function MapSettingsPanel({ value, onChange }: MapSettingsPanelProps) { const [open, setOpen] = useState(false); const update = (key: K, val: MapStyleSettings[K]) => { onChange({ ...value, [key]: val }); }; const updateDepthStop = (index: number, color: string) => { const next = value.depthStops.map((s, i) => (i === index ? { ...s, color } : s)); update('depthStops', next); }; return ( <> {open && (
지도 설정
{/* ── Language ──────────────────────────────────── */}
레이블 언어
{/* ── Land color ────────────────────────────────── */}
육지 색상
update('landColor', e.target.value)} /> {value.landColor}
{/* ── Water color ───────────────────────────────── */}
물 기본색
update('waterBaseColor', e.target.value)} /> {value.waterBaseColor}
{/* ── Depth gradient ────────────────────────────── */}
수심 구간 색상
{value.depthStops.map((stop, i) => (
{depthLabel(stop.depth)} updateDepthStop(i, e.target.value)} /> {stop.color}
))}
{/* ── Depth font size ───────────────────────────── */}
수심 폰트 크기
{FONT_SIZES.map((fs) => (
update('depthFontSize', fs.value)} > {fs.label}
))}
{/* ── Depth font color ──────────────────────────── */}
수심 폰트 색상
update('depthFontColor', e.target.value)} /> {value.depthFontColor}
{/* ── Reset ─────────────────────────────────────── */}
)} ); }