import PropTypes from 'prop-types' import React from 'react' import { ButtonDecrement, ButtonIncrement, ContainerQuantity, MarmitaCounter } from './styled' import styles from './styles.module.css' export const QuantityButton = ({ border, margin, padding, label = '', quantity = null, disabled = false, showNegativeButton = false, showPositiveButton = false, validationOne, classNameQuantity = '', validationZero = false, width, handleDecrement = () => { return }, handleIncrement = () => { return }, ...props }) => { const validateZero = validationZero && quantity >= 0 return (
{quantity != 0 && ( { return validationOne ? () => { return } : handleDecrement() }} type='button' > {' '} )} {label} {quantity != 0 &&
{validateZero ? null : quantity}
} { { return handleIncrement() }} type='button' > }
) } QuantityButton.propTypes = { border: PropTypes.any, classNameQuantity: PropTypes.string, disabled: PropTypes.bool, handleDecrement: PropTypes.func, handleIncrement: PropTypes.func, label: PropTypes.string, margin: PropTypes.any, padding: PropTypes.any, quantity: PropTypes.number, showNegativeButton: PropTypes.bool, showPositiveButton: PropTypes.bool, validationOne: PropTypes.any, validationZero: PropTypes.bool, width: PropTypes.any }