Repository URL to install this package:
|
Version:
2.7.17 ▾
|
import * as React from 'react'
import { styled } from 'styleh-components'
import { MaterialIcon } from 'atoms/MaterialIcon'
import { Button } from 'atoms/Button'
const StyledInput = styled.input.attrs({
'data-qa': 'qa-product-quantity',
type: 'number',
pattern: '/d+/',
})`
width: 40px;
border: 0;
display: inline-flex;
text-align: center;
font-size: 14px;
-webkit-appearance: textfield;
appearance: textfield;
::-webkit-inner-spin-button {
display: none;
}
`
const StyledMaterialIcon = styled(MaterialIcon)``
const StyledButton = styled(Button)`
border: 0;
background-color: transparent;
padding: 0;
${StyledMaterialIcon} {
cursor: pointer;
}
${(props: { isDisabled: boolean }) =>
props.isDisabled === true &&
styled.css`
opacity: 0.5;
${StyledMaterialIcon} {
cursor: not-allowed;
}
`};
`
const StyledPlusButton = styled(StyledButton).attrs({
'data-qa': 'qa-quantity-plus',
children: <StyledMaterialIcon type="plus" />,
})``
const StyledMinusButton = styled(StyledButton).attrs({
'data-qa': 'qa-quantity-minus',
children: <StyledMaterialIcon type="minus" />,
})``
/**
* @todo make this a label `for` the child input
*/
const IncrementerWrapper = styled.div.attrs({
'data-qa': 'qa-quantity-field-wrapper',
})`
display: flex;
flex-direction: row;
align-items: center;
width: 7rem;
border: 1px solid black;
padding: 10px;
justify-content: space-between;
`
// const Title = styled.div `
// display: block;
// font-size: rem(12);
// margin-top: $spacing;
// margin-bottom: rem(4);
// @font (11,semi);
// `
// const QuantityBox = styled.withComponent(Box) `
// width: 25%;
// width: ${props => !props.isCheckout && '115px'};
// height: ${props => !props.isCheckout && '44px'};
// padding: 0 rem(13);
// user-select: none;
// `
export {
StyledInput,
StyledButton,
StyledPlusButton,
StyledMinusButton,
IncrementerWrapper,
}