diff --git a/src/components/editor/BadgeEditorModal.tsx b/src/components/editor/BadgeEditorModal.tsx index dcbbb60..6e17418 100644 --- a/src/components/editor/BadgeEditorModal.tsx +++ b/src/components/editor/BadgeEditorModal.tsx @@ -108,7 +108,11 @@ const FONTS: Array<{ name: string; source: 'google' | 'system' }> = [ { name: 'Impact', source: 'system' } ]; -const COLORS = ['#ffffff', '#000000', '#e2001a', '#ffde00', '#ffd100', '#003399', '#001a33', '#16a34a']; +const COLORS: Array<[string, string]> = [ + ['#000000', 'Čierna'], + ['#ffffff', 'Biela'] +]; +const HEX_RE = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i; const WEIGHTS = [ ['400', 'Normal'], @@ -207,6 +211,36 @@ const NumberSlider: React.FC<{ ); +// Vlastná farba ako HEX kód (#rrggbb); uloží sa až platná hodnota +const HexColorInput: React.FC<{ value: string; onChange: (hex: string) => void }> = ({ value, onChange }) => { + const [text, setText] = useState(value); + // farba zmenená zvonka (čierna/biela, krok späť) → prepíše text v poli + const [prevValue, setPrevValue] = useState(value); + if (value !== prevValue) { + setPrevValue(value); + setText(value); + } + const valid = HEX_RE.test(text); + return ( +