All files / atom/switch/src/SwitchDesign helpers.js

100% Statements 12/12
80% Branches 4/5
100% Functions 2/2
100% Lines 10/10

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        1x     23x 23x 23x   23x     23x       181x 181x 181x 181x    
import cx from 'classnames'
 
import {BASE_CLASS} from '../config.js'
 
const CLASS_FULL_WIDTH = `${BASE_CLASS}--fullWidth`
 
export function switchClassNames({size, color, design, fullWidth}) {
  const CLASS_TYPE = `${BASE_CLASS}--design-${design}`
  const CLASS_SIZE = `${BASE_CLASS}--size-${size}`
  const CLASS_COLOR = `${BASE_CLASS}--color-${color}`
 
  const className = cx(BASE_CLASS, CLASS_TYPE, CLASS_SIZE, CLASS_COLOR, {
    [CLASS_FULL_WIDTH]: fullWidth
  })
  return className
}
 
export function suitClass({element, modifier, component = BASE_CLASS}) {
  let className = component
  Eif (element) className += `-${element}`
  if (modifier) className += `--${modifier}`
  return className
}