Sha256: 9a76ff14d58051b6a58ef8fd2c91d0817500351364d1d01aecdbf3bdba013f6e

Contents?: true

Size: 1.4 KB

Versions: 506

Compression:

Stored size: 1.4 KB

Contents

import React from 'react'
import classnames from 'classnames'
import { GlobalProps, globalProps } from '../utilities/globalProps'
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'

type ImageType = {
  alt?: string,
  aria?: {[key: string]: string},
  className?: string,
  data?: {[key: string]: string},
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
  id?: string,
  onError?: () => void,
  size?: "xs" | "sm" | "md" | "lg" | "xl",
  rounded?: boolean,
  transition?: "blur" | "fade" | "scale",
  url?: string,
} & GlobalProps

const Image = (props: ImageType): React.ReactElement => {
  const {
    alt = '',
    aria = {},
    className,
    data = {},
    htmlOptions = {},
    id,
    onError = null,
    rounded = false,
    size = '',
    transition = 'fade',
    url = '',
  } = props

  const ariaProps = buildAriaProps(aria)
  const classes = classnames(
    buildCss('pb_image_kit', size ? `size_${size}` : null),
    'lazyload',
    transition,
    { rounded },
    globalProps(props),
    className
  )
  const dataProps = buildDataProps(data)
  const htmlProps = buildHtmlProps(htmlOptions)


  return (
    <img
        {...ariaProps}
        {...dataProps}
        {...htmlProps}
        alt={alt}
        className={classes}
        data-src={url}
        id={id}
        onError={onError}
        src={url}
    />
  )
}

export default Image

Version data entries

506 entries across 506 versions & 1 rubygems

Version Path
playbook_ui-14.9.0.pre.rc.9 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-14.8.0.pre.alpha.PLAY1680newwidthprop4661 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-14.8.0.pre.alpha.PLAY1658tanstackbump4657 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-14.9.0.pre.rc.8 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-14.8.0.pre.alpha.PLAY1598floatinguiupgrade4617 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-14.9.0.pre.rc.7 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-14.9.0.pre.rc.6 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-14.9.0.pre.rc.5 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-14.8.0.pre.alpha.pbntr661createstickyleftprop4612 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-14.8.0.pre.alpha.play1648heightglobalprops4606 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-14.9.0.pre.rc.4 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-14.9.0.pre.rc.3 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-14.9.0.pre.rc.2 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-14.8.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4567 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-14.8.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4565 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-14.8.0.pre.alpha.PLAY1598floatinguiupgrade4563 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-14.8.0.pre.alpha.play1648heightglobalprops4559 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-14.9.0.pre.rc.1 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-14.8.0.pre.alpha.PLAY16254545 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-14.8.0.pre.alpha.PLAY1615movenegativetoleftofcurrencysign4543 app/pb_kits/playbook/pb_image/_image.tsx