All files / atom/input/src/Container InputContainer.js

100% Statements 3/3
75% Branches 3/4
100% Functions 1/1
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31          1x 47x                           1x                    
import cx from 'classnames'
import PropTypes from 'prop-types'
 
import {BASE, INPUT_SHAPES} from '../config.js'
 
const InputContainer = ({children, shape, noBorder, ...props}) => {
  return (
    <div
      className={cx(
        `${BASE}_Container`,
        shape && `${BASE}_Container-shape-${shape}`,
        noBorder && `${BASE}_Container-noBorder`
      )}
      {...props}
    >
      {children}
    </div>
  )
}
 
InputContainer.propTypes = {
  /** Sets the shape of the input field. It can be 'rounded', 'square' or 'circle' */
  shape: PropTypes.oneOf(Object.values(INPUT_SHAPES)),
  /** Nodes to be rendered inside the component */
  children: PropTypes.node,
  /** Removes the border from the input */
  noBorder: PropTypes.bool
}
 
export default InputContainer