All files / components/Error ErrorUI.jsx

100% Statements 31/31
33.33% Branches 1/3
100% Functions 1/1
100% Lines 31/31

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 321x 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
import React from 'react';
import Collapsible from './Collapsible';
import PropTypes from 'prop-types';
 
const ErrorUI = (props) => {
  let errorTitle = `${props.type || 'Error'} ${props.code || ''}`;
  let errorDetails = props.message;
 
  return (
    <section className="page-error">
      <div className="responsive-container">
        <h1>We’re sorry.</h1>
        <p className="h2">We cannot access this page.</p>
        <Collapsible
          showLabel="Open technical details about the error"
          hideLabel="Close technical details about the error"
          contentTitle={errorTitle}
          content={errorDetails}
        />
      </div>
    </section>
  );
};
 
ErrorUI.propTypes = {
  code: PropTypes.string,
  message: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
  type: PropTypes.string,
};
 
export default ErrorUI;