Skip to content
This repository was archived by the owner on Sep 14, 2022. It is now read-only.

Commit d0f8f66

Browse files
committed
feat: add ErrorMessages component
1 parent 62bc76a commit d0f8f66

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/components/ErrorMessages.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from "react";
2+
import { Alert } from "react-bootstrap";
3+
import type { FC } from "react";
4+
5+
interface Props {
6+
origin?: string;
7+
errors?: Error[];
8+
}
9+
10+
export const ErrorMessages: FC<Props> = (props) => {
11+
if (!props.errors) {
12+
return null;
13+
}
14+
15+
return (
16+
<>
17+
{props.errors?.map((error, index) => {
18+
return (
19+
<Alert variant="danger" key={`error-msg-${index}`}>
20+
{`${props.origin ?? ""}`}
21+
{`${error.message}`}
22+
</Alert>
23+
);
24+
})}
25+
</>
26+
);
27+
};

0 commit comments

Comments
 (0)