import { useState } from 'react'; import { useFontScale } from '../../hooks/useFontScale'; import type { FontScaleConfig } from '../../contexts/fontScaleState'; const LABELS: Record = { facility: '시설 라벨', ship: '선박 이름', analysis: '분석 라벨', area: '지역/국가명', }; export function FontScalePanel() { const { fontScale, setFontScale } = useFontScale(); const [open, setOpen] = useState(false); const update = (key: keyof FontScaleConfig, val: number) => { setFontScale({ ...fontScale, [key]: Math.round(val * 10) / 10 }); }; return (
{open && (
{(Object.keys(LABELS) as (keyof FontScaleConfig)[]).map(key => (
update(key, parseFloat(e.target.value))} /> {fontScale[key].toFixed(1)}
))}
)}
); }