Sha256: cdb37b19c5f297b0d359a39acdb65c617e4bc279adb48a42453f33cd77acf4dd

Contents?: true

Size: 1.22 KB

Versions: 386

Compression:

Stored size: 1.22 KB

Contents

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

type ImageType = {
  alt?: string,
  aria?: {[key: string]: string},
  className?: string,
  data?: {[key: string]: string},
  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 = {},
    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)

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

export default Image

Version data entries

386 entries across 386 versions & 1 rubygems

Version Path
playbook_ui-11.9.0.pre.alpha.fileupload1 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-11.8.1 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-11.8.0 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-11.7.0.pre.alpha.table1 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-11.7.0 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-11.6.0.pre.alpha.fontawesome app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-11.5.0.pre.alpha.fontawesome app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-11.7.0.pre.alpha.pre.guagechart1 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-11.6.0 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-11.5.0.pre.alpha.datepicker1 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-11.6.0.pre.alpha.rubocopperf1 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-11.6.1.pre.alpha.rubocop.pre.performance1 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-11.5.0.pre.alpha.pre.rubocop app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-11.6.0.pre.alpha.momenttz1 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-11.5.0 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-11.4.0.pre.alpha.rubytheme2 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-11.4.0.pre.alpha.rubytheme1 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-11.4.0 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-11.3.0.pre.alpha2 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-11.3.0.pre.alpha1 app/pb_kits/playbook/pb_image/_image.tsx