'use client'; import React, { useState } from 'react'; import { Button } from '../ui/button'; // Adjust import path to where your shadcn Button component is located 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] = useState(initialCount); const increment = () => { if (count < max) { const newCount = count + 1; setCount(newCount); if (onChange) { onChange(newCount); } } }; const decrement = () => { if (count > min) { const newCount = count - 1; setCount(newCount); if (onChange) { onChange(newCount); } } }; return (
{count}
); }; export default NumberPicker;