Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: centered error message #170

Merged
merged 1 commit into from
Jun 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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