import classNames from 'classnames' import { __ } from '@wordpress/i18n' import cartReduceIcon from '../../../../public/images/icon-cart-reduce.svg' import cartIncreaseIcon from '../../../../public/images/icon-cart-increase.svg' import { useWording } from '../../hooks/useWording' import { ICounterInputProps } from './types' import './CounterInput.scss' export const CounterInput = ({ value, min, max, label, layout = 'stacked', disabled = false, onChange, }: ICounterInputProps) => { const wording = useWording() const canDecrease = !disabled && value > min const canIncrease = !disabled && (max === undefined || value < max) const handleDecrease = () => { if (canDecrease) onChange(value - 1) } const handleIncrease = () => { if (canIncrease) onChange(value + 1) } return (