Sha256: eee36436d2b82030e549a0884d96cd09b2667d81ac6b24a6984fae654dbf00f7

Contents?: true

Size: 1.4 KB

Versions: 86

Compression:

Stored size: 1.4 KB

Contents

import React from 'react'
import { Body, Image } from '../../'

const CustomErrorImage = (props) => {
  return (
    <>
      <Body text="Handle when an image fails to load or a broken link is passed. This is not neccessary most of the time." />
      <br />
      <Body text="Alter the display when the image fails to load:" />
      <Image
          alt="This is the alt text!"
          onError={(e) => e.target.style.color = 'red'}
          rounded
          size="xs"
          url="not_a_valid_url"
          {...props}
      />
      <br />
      <br />
      <Body text="Give it an error class:" />
      <Image
          alt="This is the alt text!"
          onError={(e) => e.target.classList.add('image-error')}
          rounded
          size="sm"
          url="not_a_valid_url"
          {...props}
      />
      <br />
      <br />
      <Body text="Set an inline style" />
      <Image
          alt="This is the alt text!"
          onError={(e) => e.target.style.outline = '1px solid red'}
          rounded
          size="md"
          url="not_a_valid_url"
          {...props}
      />
      <br />
      <br />
      <Body text="Hide it completely!" />
      <Image
          alt="This is the alt text!"
          onError={(e) => e.target.style.display = 'none'}
          rounded
          size="md"
          url="not_a_valid_url"
          {...props}
      />
    </>
  )
}

export default CustomErrorImage

Version data entries

86 entries across 86 versions & 1 rubygems

Version Path
playbook_ui-9.9.0.alpha.inline1 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-9.9.0 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-9.8.0 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-9.7.0.pre.alphawidth1 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-9.7.0.pre.alpha.a11y.btn app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-9.7.0 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-9.6.1 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-9.6.1.pre.deps1 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-9.6.0 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-9.5.0.alpha.rs.downgrade app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-9.5.0 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-9.4.0.alpha.sisense app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-9.4.0.alpha.user.kit.bug app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-9.4.0 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-9.3.1.pre.alpha2 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-9.4.0.pre.alpha2 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-9.4.0.pre.alpha1 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-9.3.1.pre.alpha1 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-9.3.0.alpha.inline3 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-9.3.0.pre.alpha.password.strength.2 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx