Repository navigation
Expand file tree
/
Copy pathAlert.js
More file actions
52 lines (51 loc) · 1.57 KB
/
Copy pathAlert.js
File metadata and controls
52 lines (51 loc) · 1.57 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { FaInfoCircle } from "react-icons/fa";
import { MdError, MdOutlineWarningAmber } from "react-icons/md";
import { FaRegCheckCircle } from "react-icons/fa";
export default function alert({ type, message }) {
switch (type) {
case "success":
return (
<div
className={`alert-${type} bg-green-100 rounded-lg py-5 px-6 mb-3 text-base text-green-700 inline-flex items-center w-full animate-pulse`}
role="alert"
>
<FaRegCheckCircle className="mr-2" />
<span>{message}</span>
</div>
);
break;
case "error":
return (
<div
className={`alert-${type} bg-red-100 rounded-lg py-5 px-6 mb-3 text-base text-red-700 inline-flex items-center w-full animate-pulse`}
role="alert"
>
<MdError className="mr-2" />
<span>{message}</span>
</div>
);
break;
case "warning":
return (
<div
className={`alert-${type} bg-yellow-100 rounded-lg py-5 px-6 mb-3 text-base text-yellow-700 inline-flex items-center w-full animate-pulse`}
role="alert"
>
<MdOutlineWarningAmber className="mr-2" />
<span>{message}</span>
</div>
);
break;
case "info":
return (
<div
className={`alert-${type} bg-blue-100 rounded-lg py-5 px-6 mb-3 text-base text-blue-700 inline-flex items-center w-full animate-pulse`}
role="alert"
>
<FaInfoCircle className="mr-2" />
<span>{message}</span>
</div>
);
break;
}
}