From 96b343342f2e027176422ba12db0a1d53fe95a97 Mon Sep 17 00:00:00 2001 From: Shobhit Gupta Date: Wed, 7 Jun 2023 14:12:50 +0530 Subject: [PATCH] fix: centered error message (#170) --- src/components/Error/Error.jsx | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/components/Error/Error.jsx b/src/components/Error/Error.jsx index 395ba5a..bed7a49 100644 --- a/src/components/Error/Error.jsx +++ b/src/components/Error/Error.jsx @@ -1,7 +1,7 @@ import { useState, useEffect } from "react"; import ErrorCard from "./ErrorCard"; import { errors } from "../../data/error.json"; -import { Toaster } from 'react-hot-toast'; +import { Toaster } from "react-hot-toast"; const Error = ({ search, type }) => { const [error, setError] = useState([]); @@ -20,8 +20,8 @@ const Error = ({ search, type }) => { const filteredErrorByType = filteredError.filter((error) => { if (type === "All") { return error; - } return error.type.toLowerCase().includes(type.toLowerCase()); - + } + return error.type.toLowerCase().includes(type.toLowerCase()); }); return ( @@ -31,21 +31,25 @@ const Error = ({ search, type }) => { position="top-right" toastOptions={{ success: { - theme: { - primary: '#4aed88', - }, + theme: { + primary: "#4aed88", + }, }, }} > -
+
{filteredErrorByType.length === 0 ? ( -

No Error Found

- ) : ( - filteredErrorByType.map((error, idx) => ( - - )) - )} +
+

+ No Error Found +

+
+ ) : ( + filteredErrorByType.map((error, idx) => ( + + )) + )}
);