Sha256: fe6d2bb353306fdd8ad6034fa5e37a915037614d1654fefa1851a0a6cb712387

Contents?: true

Size: 1.13 KB

Versions: 124

Compression:

Stored size: 1.13 KB

Contents

/* @flow */

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

type ImageProps = {
  alt?: string,
  aria?: object,
  className?: string,
  data?: object,
  id?: string,
  onError?: () => {},
  size: "xs" | "sm" | "md" | "lg" | "xl",
  rounded?: boolean,
  url: string,
}

const Image = (props: ImageProps) => {
  const {
    alt = '',
    aria = {},
    className,
    data = {},
    id,
    onError = null,
    rounded = false,
    size = '',
    url = '',
  } = props

  const ariaProps = buildAriaProps(aria)
  const classes = classnames(
    buildCss('pb_image_kit', size),
    'lazyload',
    'blur_up',
    { rounded },
    globalProps(props),
    className
  )
  const dataProps = buildDataProps(data)

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

export default Image

Version data entries

124 entries across 124 versions & 1 rubygems

Version Path
playbook_ui-8.1.3 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-8.4.0.alpha.dependencies.2 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-8.4.0.alpha.dependencies.1 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-8.2.0.pre.alpha4 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-8.2.0.pre.alpha3 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-8.2.0 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-8.1.2 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-8.1.0.pre.alpha1 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-8.0.3 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-8.2.0.pre.alpha2 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-8.1.1 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-8.0.2 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-8.2.0.pre.alpha1 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-8.1.0 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-8.0.1 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-8.0.0 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-8.0.0.pre.alpha5 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-8.0.0.pre.alpha4 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-8.0.0.pre.alpha1 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-7.16.0.pre.alpha5 app/pb_kits/playbook/pb_image/_image.jsx