Skip to content

Commit

Permalink
Merge branch 'main' into add-related-blogs-header
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyTron authored Jan 11, 2024
2 parents ae63223 + a2f91d3 commit 65e563d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/APP/pages/blog/Blog.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { useParams } from "react-router-dom";
import { useParams, useNavigate } from "react-router-dom";

import BlogWrapper from "./sections/BlogWrapper";
import RelatedBlogs from "./sections/RelatedBlogs";
Expand All @@ -8,6 +8,7 @@ import useBlogData from "../../../hooks/Queries/blog/useBlogData";

function Blog() {
const { title_slug } = useParams();
const navigate = useNavigate();
const {
data: blogData,
isLoading,
Expand All @@ -17,7 +18,7 @@ function Blog() {

return (
<div className="w-screen max-w-[1440px] mx-auto">
{isError && <p>Error fetching blog details!</p>}
{isError && navigate("/error-500")}
{isLoading && (
<div className="flex flex-col items-center justify-center gap-4 py-10">
<Loader />
Expand Down Expand Up @@ -49,4 +50,3 @@ function Blog() {
}

export default Blog;

4 changes: 3 additions & 1 deletion src/APP/pages/blogs/sections/BlogsWrapper.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-disable operator-linebreak */
/* eslint-disable react/jsx-indent */
import React, { useState, useEffect, useContext } from "react";
import { useNavigate } from "react-router-dom";

import BlogCard from "./BlogCard";
import BlogPagination from "./BlogPagination";
import Error500 from "../../errorPages/Error500";
import { Loader } from "../../../components";

import { SearchBlogContext } from "../../../../context/searchBlog";
Expand All @@ -19,7 +19,9 @@ function SearchResults({ searchText }) {
return (
<h3 className="text-black text-xl md:text-3xl font-semibold leading-8 md:leading-loose text-center">
Showing results for

<span className="text-primary"> "{searchText}"</span>

</h3>
);
}
Expand Down
20 changes: 20 additions & 0 deletions src/router/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ import {
Checkout,
SingleEvent,
SingleProductDonation,
Error500,
Error404,
Error400,
Error403,
} from "../APP";
// import {
// AllChaptersPage,
Expand Down Expand Up @@ -116,6 +120,22 @@ const router = createBrowserRouter([
// },
],
},
{
path: "/error-400",
element: <Error400 />,
},
{
path: "/error-403",
element: <Error403 />,
},
{
path: "/*",
element: <Error404 />,
},
{
path: "/error-500",
element: <Error500 />,
},

// {
// path: "/admin",
Expand Down

0 comments on commit 65e563d

Please sign in to comment.