All files / molecule/photoUploader/src/DragState index.js

60% Statements 3/5
0% Branches 0/1
0% Functions 0/1
60% Lines 3/5

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 32                1x                           1x   1x              
import cx from 'classnames'
import PropTypes from 'prop-types'
 
import AtomIcon, {ATOM_ICON_SIZES} from '@s-ui/react-atom-icon'
 
import {DRAG_STATE_STATUS_ACCEPTED, DRAG_STATE_STATUS_REJECTED} from '../config.js'
import {DRAG_STATE_CLASS_NAME} from './config.js'
 
const DragState = ({icon, status = DRAG_STATE_STATUS_ACCEPTED, text}) => {
  const dropzoneClassName = cx(DRAG_STATE_CLASS_NAME, {
    [`${DRAG_STATE_CLASS_NAME}--accepted`]: status === DRAG_STATE_STATUS_ACCEPTED,
    [`${DRAG_STATE_CLASS_NAME}--rejected`]: status === DRAG_STATE_STATUS_REJECTED
  })
 
  return (
    <div className={dropzoneClassName}>
      <AtomIcon size={ATOM_ICON_SIZES.extraLarge}>{icon}</AtomIcon>
      <div className={`${DRAG_STATE_CLASS_NAME}-textState`}>{text}</div>
    </div>
  )
}
 
DragState.displayName = 'DragState'
 
DragState.propTypes = {
  icon: PropTypes.node.isRequired,
  status: PropTypes.string,
  text: PropTypes.string.isRequired
}
 
export default DragState