All files / react/components/Error ErrorUI.jsx

40% Statements 2/5
0% Branches 0/4
0% Functions 0/1
40% Lines 2/5

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      1x                                       1x              
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;