import React from "react"; import Palette, { palettes } from "./Palette"; interface PaletteSelectProps { value: Palette; onChange: (palette: Palette) => void; } function PaletteSelect({ value, onChange }: PaletteSelectProps) { const handlePaletteChange = (event: React.ChangeEvent) => { onChange(palettes[parseInt(event.target.value)]); }; // Index of the palette in the palettes array, used as the value of the select const valueIndex = palettes.findIndex((p) => p === value); const paletteOptions = palettes.map((palette, index) => ( )); return ( ); } export default PaletteSelect;