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