mirror of
https://github.com/WDI-Ideas/rubix.git
synced 2026-04-27 18:45:49 +00:00
Created route for blogposts
This commit is contained in:
@@ -16,6 +16,7 @@ import fb from "../../assets/images/fb.png";
|
||||
import { useGetBlogQuery } from "../../Redux/slice/blogsSlice";
|
||||
import { Link, useParams } from "react-router-dom";
|
||||
import NotFound from "../../pages/NotFound";
|
||||
import Loader from "../Loader/Loader";
|
||||
|
||||
const BlogPost = () => {
|
||||
const { title_slug } = useParams();
|
||||
@@ -28,7 +29,11 @@ const BlogPost = () => {
|
||||
}, []);
|
||||
|
||||
if (isLoading) {
|
||||
return <div>Loading...</div>;
|
||||
return (
|
||||
<div>
|
||||
<Loader />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const matchingBlogPost = blogPosts
|
||||
|
||||
@@ -8,13 +8,10 @@ import { Link, useParams } from "react-router-dom";
|
||||
import { useGetBlogQuery } from "../../Redux/slice/blogsSlice";
|
||||
|
||||
const HomeCard = ({ cardkey, date, text, link }) => {
|
||||
const { title_slug } = useParams();
|
||||
const { data } = useGetBlogQuery();
|
||||
const blogCards = data?.data;
|
||||
|
||||
const matchingBlogPost = blogCards
|
||||
? blogCards.find((item) => item.title_slug === title_slug)
|
||||
: null;
|
||||
console.log(blogCards);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -94,7 +91,7 @@ const HomeCard = ({ cardkey, date, text, link }) => {
|
||||
WebkitLineClamp: 2,
|
||||
}}
|
||||
>
|
||||
{card.meta_description}
|
||||
{card.title}
|
||||
</Text>
|
||||
<Box
|
||||
display={"flex"}
|
||||
|
||||
@@ -101,7 +101,7 @@ const MobileFooter = () => {
|
||||
color={"#B0B0B0"}
|
||||
fontFamily={"Mona Sans"}
|
||||
fontWeight={"500"}
|
||||
fontSize={"22px"}
|
||||
fontSize={"16px"}
|
||||
>
|
||||
Social
|
||||
</Text>
|
||||
|
||||
@@ -30,6 +30,7 @@ import Ecosystem from "../pages/Ecosystem";
|
||||
import Events from "../pages/Events";
|
||||
import NewsPage from "../pages/NewsPage";
|
||||
import EventsInternnal from "../pages/EventsInternnal";
|
||||
import BlogPost from "../components/BlogPost/BlogPost";
|
||||
|
||||
export const route = [
|
||||
{
|
||||
@@ -105,6 +106,10 @@ export const route = [
|
||||
path: "events-internal",
|
||||
element: <EventsInternnal />,
|
||||
},
|
||||
{
|
||||
path: "blogs/:title_slug",
|
||||
element: <BlogPost />,
|
||||
},
|
||||
{
|
||||
path: "*",
|
||||
element: <NotFound />,
|
||||
|
||||
Reference in New Issue
Block a user