import { useMemo } from "react";
import NumberSelectorArray from "./NumberSelectorArray";

export default function NumberSelector({
	value,
	label,
	minValue,
	maxValue,
	onChange
}:{
	value: number;
	label: string;
	minValue: number;
	maxValue: number;
	onChange: (newShift: number) => void;
}){
	const shiftArray: number[] = useMemo(() => (
		Array.from({ length: maxValue - minValue + 1 }, (_, i) => i + minValue)
	), [ minValue, maxValue ]);
	//TODO: Perform a check for minValue <= value <= maxValue


	return (
		<NumberSelectorArray
			value={value}
			label={label}
			shiftArray={shiftArray}
			onChange={onChange}
		/>
	);
}
