Sha256: c76c02d3d40d638d85d49d2d54becb2eb589ebb1cd123d44585a6871031bae1e

Contents?: true

Size: 1.44 KB

Versions: 1648

Compression:

Stored size: 1.44 KB

Contents

import React from 'react'

import Image from '../_image'

import Body from '../../pb_body/_body'

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

1,648 entries across 1,648 versions & 2 rubygems

Version Path
playbook_ui_docs-14.8.0.pre.alpha.PLAY1615movenegativetoleftofcurrencysign4539 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-14.8.0.pre.alpha.PLAY1615movenegativetoleftofcurrencysign4539 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui_docs-14.9.0.pre.rc.0 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-14.9.0.pre.rc.0 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui_docs-14.7.0.pre.alpha.dependabotnpmandyarnfloatinguireact026284532 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-14.7.0.pre.alpha.dependabotnpmandyarnfloatinguireact026284532 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-14.8.0 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui_docs-14.7.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4523 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-14.7.0.pre.alpha.revert3916revert3893PBNTR667railstypeaheadformintegration4523 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui_docs-14.8.0.pre.rc.8 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-14.8.0.pre.rc.8 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui_docs-14.8.0.pre.rc.7 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-14.8.0.pre.rc.7 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui_docs-14.8.0.pre.rc.6 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-14.8.0.pre.rc.6 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui_docs-14.8.0.pre.rc.5 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-14.8.0.pre.rc.5 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui_docs-14.8.0.pre.rc.4 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui-14.8.0.pre.rc.4 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx
playbook_ui_docs-14.8.0.pre.rc.3 app/pb_kits/playbook/pb_image/docs/_custom_error_image.jsx