import React from 'react'; import { Button } from '../ui/button'; interface NumberPickerProps { initialCount?: number; min?: number; max?: number; onChange?: (count: number) => void; } const NumberPicker: React.FC = ({ initialCount = 1, min = 1, max = 10, onChange, }) => { const [count, setCount] = React.useState(initialCount); React.useEffect(() => { if (onChange) { onChange(count); } }, [count, onChange]); const increment = () => { if (count < max) { setCount(count + 1); } }; const decrement = () => { if (count > min) { setCount(count - 1); } }; return (
{count}
); }; export default NumberPicker;