Sha256: 257e6c8f601ca12ee79b3f081a48f24f4b7e030ec9646801d7108e5406a0dbd3

Contents?: true

Size: 1.2 KB

Versions: 15

Compression:

Stored size: 1.2 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) => {
  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

15 entries across 15 versions & 1 rubygems

Version Path
playbook_ui-10.26.0.pre.alpha.sticky1 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-10.25.1 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-10.26.0.pre.alpha1 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-10.25.0 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-10.25.0.pre.alpha3 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-10.25.0.pre.treeshaking1 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-10.24.0 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-10.24.0.pre.alpha1 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-10.23.0 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-10.23.0.pre.alpha2 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-10.23.0.pre.alpha1 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-10.22.1 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-10.22.0 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-10.21.1.pre.alpha1 app/pb_kits/playbook/pb_image/_image.tsx
playbook_ui-10.21.0 app/pb_kits/playbook/pb_image/_image.tsx