How to use the @instructure/ui-react-utils.getElementType function in @instructure/ui-react-utils

To help you get started, we’ve selected a few @instructure/ui-react-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github instructure / instructure-ui / packages / ui-a11y / src / Dialog / index.js View on Github external
render () {
    const ElementType = getElementType(Dialog, this.props)
    return this.props.open ? (
      
        {this.props.children}
      
    ) : null
  }
}
github instructure / instructure-ui / packages / ui-layout / src / View / index.js View on Github external
maxWidth,
      maxHeight,
      overflowX,
      overflowY,
      stacking,
      shadow,
      position,
      focusPosition,
      focusColor,
      shouldAnimateFocus,
      borderColor,
      size, // eslint-disable-line react/prop-types
      className // eslint-disable-line react/prop-types
    } = this.props

    const ElementType = getElementType(View, this.props)

    const focusOutlineClasses = position === 'relative' ? {
      [styles[this.focusRingRadius]]: true,
      [styles[`focusPosition--${focusPosition}`]]: true,
      [styles[`focusColor--${focusColor}`]]: true,
      [styles[`focusAnimation`]]: shouldAnimateFocus
    } : {}

    const classes = classnames({
      [styles.root]: true,
      [styles.debug]: debug,
      [styles.hasBorder]: this.hasBorder,
      [styles[`borderColor--${borderColor}`]]: this.hasBorder && borderColor !== 'inverse',
      [styles['borderColor--inverse']]: this.hasBorder && background === 'inverse',
      [styles[`textAlign--${textAlign}`]]: textAlign,
      [styles[`background--${background}`]]: background,
github instructure / instructure-ui / packages / ui-a11y-content / src / AccessibleContent / index.js View on Github external
render () {
    const { alt, children, ...props } = this.props
    const ElementType = getElementType(AccessibleContent, this.props)

    return (
      
        
          {alt}
        
        
          {children}
        
      
    )
  }
}
github instructure / instructure-ui / packages / ui-options / src / Options / Separator / index.js View on Github external
render () {
    const { as, ...rest } = this.props
    const ElementType = getElementType(Separator, this.props, () => (as))

    return (
      
        <div role="presentation">
      
    )
  }
}</div>
github instructure / instructure-ui / packages / ui-tooltip / src / Tooltip / index.js View on Github external
renderTrigger () {
    const { children, as } = this.props
    const { hasFocus } = this.state
    const triggerProps = {
      'aria-describedby': this._id
    }

    if (as) {
      const Trigger = getElementType(Tooltip, this.props)
      const props = omitProps(this.props, Tooltip.propTypes)
      return (
        
          {children}
        
      )
    } else if (typeof children === 'function') {
      return children(
        {
          focused: hasFocus,
          getTriggerProps: (props) =&gt; {
            return {
              ...triggerProps,
              ...props
            }
          }
github instructure / instructure-ui / packages / ui-calendar / src / Calendar / Day / index.js View on Github external
get elementType () {
    const { as } = this.props
    return as || getElementType(Day, this.props)
  }
github instructure / instructure-ui / packages / ui-billboard / src / Billboard / index.js View on Github external
href,
      disabled,
      readOnly,
      onClick,
      size,
      margin,
      elementRef
    } = this.props

    const classes = {
      [styles.root]: true,
      [styles[size]]: true,
      [styles.clickable]: href || onClick,
      [styles.disabled]: disabled
    }
    const Element = getElementType(Billboard, this.props)

    return (