| 1 | import type { BasicFilters } from "../lib/types"; |
| 2 | import { Slider } from "./Slider"; |
| 3 | |
| 4 | interface SliderGroupProps { |
| 5 | filters: BasicFilters; |
| 6 | onChange: (key: keyof BasicFilters, value: number) => void; |
| 7 | } |
| 8 | |
| 9 | const SLIDER_CONFIG: { |
| 10 | key: keyof BasicFilters; |
| 11 | label: string; |
| 12 | min: number; |
| 13 | max: number; |
| 14 | }[] = [ |
| 15 | { key: "brightness", label: "BRIGHTNESS", min: 0, max: 200 }, |
| 16 | { key: "contrast", label: "CONTRAST", min: 0, max: 200 }, |
| 17 | { key: "exposure", label: "EXPOSURE", min: -100, max: 100 }, |
| 18 | { key: "saturation", label: "SATURATION", min: 0, max: 200 }, |
| 19 | { key: "temperature", label: "TEMPERATURE", min: -100, max: 100 }, |
| 20 | { key: "tint", label: "TINT", min: -100, max: 100 }, |
| 21 | { key: "highlights", label: "HIGHLIGHTS", min: -100, max: 100 }, |
| 22 | { key: "shadows", label: "SHADOWS", min: -100, max: 100 }, |
| 23 | ]; |
| 24 | |
| 25 | export function SliderGroup({ filters, onChange }: SliderGroupProps) { |
| 26 | return ( |
| 27 | <div className="slider-group"> |
| 28 | {SLIDER_CONFIG.map(({ key, label, min, max }) => ( |
| 29 | <Slider |
| 30 | key={key} |
| 31 | label={label} |
| 32 | value={filters[key]} |
| 33 | min={min} |
| 34 | max={max} |
| 35 | onChange={(v) => onChange(key, v)} |
| 36 | /> |
| 37 | ))} |
| 38 | </div> |
| 39 | ); |
| 40 | } |