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-10.17.0 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-10.16.0 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-10.15.1 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-10.15.1.pre.alpha.rubocop.deps app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-10.15.0 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-10.14.1.pre.alpha2 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-10.14.1.pre.alpha1 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-10.14.0 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-10.13.1 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-10.13.0 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-10.13.0.pre.node.update app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-10.12.0 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-10.11.0 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-10.10.0 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-10.9.0 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-10.8.1.pre.alpha.flexdeps app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-10.9.0.pre.alpha1 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-10.8.0 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-10.7.1 app/pb_kits/playbook/pb_image/_image.jsx
playbook_ui-10.7.0 app/pb_kits/playbook/pb_image/_image.jsx