Skip to content

Commit

Permalink
fix: centered error message (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
shobhitexe committed Jun 7, 2023
1 parent 4588f5c commit 96b3433
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions src/components/Error/Error.jsx
Original file line number Diff line number Diff line change
@@ -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([]);
Expand All @@ -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 (
Expand All @@ -31,21 +31,25 @@ const Error = ({ search, type }) => {
position="top-right"
toastOptions={{
success: {
theme: {
primary: '#4aed88',
},
theme: {
primary: "#4aed88",
},
},
}}
></Toaster>
</div>
<section className="mx-4 md:w-5/6 my-12 grid grid-cols-12 justify-center gap-8 md:mx-auto">
<section className="mx-4 md:w-5/6 my-12 grid grid-cols-12 justify-center gap-8 md:mx-auto ">
{filteredErrorByType.length === 0 ? (
<h1 className="text-center text-2xl text-gray-500">No Error Found</h1>
) : (
filteredErrorByType.map((error, idx) => (
<ErrorCard key={idx} error={error} />
))
)}
<div className="col-span-12">
<h1 className="text-center text-2xl text-gray-500 mx-auto">
No Error Found
</h1>
</div>
) : (
filteredErrorByType.map((error, idx) => (
<ErrorCard key={idx} error={error} />
))
)}
</section>
</>
);
Expand Down

1 comment on commit 96b3433

@vercel
Copy link

@vercel vercel bot commented on 96b3433 Jun 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.