-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from SpaceyaTech/blog-admin-forms
add link to blogCard
- Loading branch information
Showing
2 changed files
with
56 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,44 @@ | ||
import React from "react"; | ||
import { useParams } from "react-router-dom"; | ||
import BlogStats from "../blogs/sections/BlogStats"; | ||
import BlogWrapper from "./sections/BlogWrapper"; | ||
import useBlogData from "../../../hooks/Queries/blog/useBlogData"; | ||
|
||
function Blog() { | ||
const { id } = useParams(); | ||
const { data: blogData, isLoading, isError, isSuccess } = useBlogData(id); | ||
|
||
return ( | ||
<> | ||
{isError && <p>Error fetching blog details!</p>} | ||
{isLoading && <p>Loading blog details...</p>} | ||
{isSuccess && ( | ||
<section className="flex flex-col p-4 md:p-8 lg:p-10"> | ||
<img | ||
src={blogData.image} | ||
alt="blog" | ||
className="w-full h-60 md:h-72 object-cover rounded-lg mb-4 md:mb-8" | ||
/> | ||
|
||
<div className="flex flex-row items-center justify-between"> | ||
<p className="text-[#4C4D4D] text-sm md:text-base font-bold"> | ||
{new Date(blogData.created_at).toLocaleDateString("en-US", { | ||
year: "numeric", | ||
month: "short", | ||
day: "numeric", | ||
})} | ||
</p> | ||
|
||
<BlogStats likes={blogData.likes} /> | ||
</div> | ||
|
||
<BlogWrapper blog={blogData} /> | ||
|
||
{/* <RelatedBlogs /> */} | ||
</section> | ||
)} | ||
</> | ||
); | ||
} | ||
|
||
export default Blog; | ||
import React from "react"; | ||
import { useParams } from "react-router-dom"; | ||
import BlogWrapper from "./sections/BlogWrapper"; | ||
import useBlogData from "../../../hooks/Queries/blog/useBlogData"; | ||
|
||
function Blog() { | ||
const { id } = useParams(); | ||
const { data: blogData, isLoading, isError, isSuccess } = useBlogData(id); | ||
|
||
return ( | ||
<section className=" max-w-[1440px] mx-auto"> | ||
{isError && <p>Error fetching blog details!</p>} | ||
{isLoading && <p>Loading blog details...</p>} | ||
{isSuccess && ( | ||
<section className="flex flex-col p-4 md:p-8 lg:p-10"> | ||
<img | ||
src={blogData.image} | ||
alt="blog" | ||
className="w-full h-60 md:h-72 object-cover rounded-lg mb-4 md:mb-8" | ||
/> | ||
|
||
{/* <div className="flex flex-row items-center justify-between"> | ||
<p className="text-[#4C4D4D] text-sm md:text-base font-bold"> | ||
{new Date(blogData.created_at).toLocaleDateString("en-US", { | ||
year: "numeric", | ||
month: "short", | ||
day: "numeric", | ||
})} | ||
</p> | ||
<BlogStats likes={blogData.likes} /> | ||
</div> */} | ||
|
||
<BlogWrapper blog={blogData} /> | ||
|
||
{/* <RelatedBlogs /> */} | ||
</section> | ||
)} | ||
</section> | ||
); | ||
} | ||
|
||
export default Blog; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters