* start link validation check * keep PRs small * rearrange check flow * need a change to switch accounts * Rescue from SocketError to surface a better error message * some updates * handle 301s * address Travis failures * implement request stub * add needed unified-embed tag spec * add needed unified-embed tag spec * nudge Travis * Address PR review comments * special-case displaying "base" * undo change to errors.add * nudge Travis * more succinct code Co-authored-by: aritmock <aritmock@example.com> Co-authored-by: Dwight Scott <dwight@forem.com>
28 lines
683 B
JavaScript
28 lines
683 B
JavaScript
import { h } from 'preact';
|
|
import PropTypes from 'prop-types';
|
|
|
|
export const ErrorList = ({ errors }) => {
|
|
return (
|
|
<div
|
|
data-testid="error-message"
|
|
className="crayons-notice crayons-notice--danger mb-6"
|
|
>
|
|
<h3 className="fs-l mb-2 fw-bold">Whoops, something went wrong:</h3>
|
|
<ul className="list-disc pl-6">
|
|
{Object.keys(errors).map((key) => {
|
|
return (
|
|
<li key={key}>
|
|
{key === 'base' ? errors[key] : `${key}: ${errors[key]}`}
|
|
</li>
|
|
);
|
|
})}
|
|
</ul>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
ErrorList.propTypes = {
|
|
errors: PropTypes.object.isRequired,
|
|
};
|
|
|
|
ErrorList.displayName = 'ErrorList';
|