All files / primitive/linkBox/src index.js

85.71% Statements 6/7
66.66% Branches 4/6
100% Functions 1/1
100% Lines 6/6

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 5x 5x 5x             1x 1x                  
import {forwardRef} from 'react'
 
import cx from 'classnames'
import PropTypes from 'prop-types'
 
import PrimitiveInjector from '@s-ui/react-primitive-injector'
 
import PrimitiveLinkBoxLink from './PrimitiveLinkBoxLink.js'
import PrimitiveLinkBoxRaised from './PrimitiveLinkBoxRaised.js'
import {BASE_CLASS_NAME} from './settings.js'
 
const PrimitiveLinkBox = forwardRef(({children, as, className, ...props}) => {
  Iif (children === undefined) return null
  const Component = as === undefined && typeof children === 'string' ? 'div' : PrimitiveInjector
  return (
    <Component className={cx(BASE_CLASS_NAME, className)} {...props}>
      {children}
    </Component>
  )
})
 
PrimitiveLinkBox.displayName = 'PrimitiveLinkBox'
PrimitiveLinkBox.propTypes = {
  as: PropTypes.elementType,
  children: PropTypes.node,
  className: PropTypes.string
}
 
export {PrimitiveLinkBoxRaised, PrimitiveLinkBoxLink}
 
export default PrimitiveLinkBox