From 6cab1fbf5bc31394b547f6983fc49f7798f077c3 Mon Sep 17 00:00:00 2001 From: Rohit Date: Fri, 14 Jun 2024 23:57:55 +0530 Subject: [PATCH] feature/blog-drawer --- app/(root)/(pages)/blog/[blogId]/page.tsx | 2 +- components/custom/blog/BlogActionButton.tsx | 39 ++++++--------- components/custom/blog/BlogCommentField.tsx | 46 ++++++++++++++++++ components/custom/details/BlogDetails.tsx | 6 +-- .../custom/drawers/BlogCommentDrawer.tsx | 47 ++----------------- .../drawers/BlogCommentMobileDrawer.tsx | 18 ++++--- components/ui/drawer.tsx | 2 +- 7 files changed, 83 insertions(+), 77 deletions(-) create mode 100644 components/custom/blog/BlogCommentField.tsx diff --git a/app/(root)/(pages)/blog/[blogId]/page.tsx b/app/(root)/(pages)/blog/[blogId]/page.tsx index fbea95d..176bbec 100644 --- a/app/(root)/(pages)/blog/[blogId]/page.tsx +++ b/app/(root)/(pages)/blog/[blogId]/page.tsx @@ -29,7 +29,7 @@ export default async function DynamicBlog({ params }: { params: { blogId: string const response = await getBlogDetails(blogId); return ( -
+
diff --git a/components/custom/blog/BlogActionButton.tsx b/components/custom/blog/BlogActionButton.tsx index cbca14d..ecfacd7 100644 --- a/components/custom/blog/BlogActionButton.tsx +++ b/components/custom/blog/BlogActionButton.tsx @@ -19,41 +19,31 @@ import {FaXTwitter} from "react-icons/fa6"; import {FaInstagram, FaLinkedin} from "react-icons/fa"; import BlogCommentDrawer from "@/components/custom/drawers/BlogCommentDrawer"; import BlogCommentMobileDrawer from "@/components/custom/drawers/BlogCommentMobileDrawer"; +import useMediaQuery from "@/hooks/useMediaQuery"; + +const BlogActionButton = ({data, isDividerShown = true}: { data: any, isDividerShown?: boolean }) => { + + const breakPoint = useMediaQuery(640); -const BlogActionButton = ({data, isDividerShown = true}: {data: any, isDividerShown?: boolean }) => { return (
{isDividerShown && }
-
+
10 - +
-
- - 10 - - -
- -
+
10 - + {breakPoint ? : }
@@ -70,7 +60,8 @@ const BlogActionButton = ({data, isDividerShown = true}: {data: any, isDividerSh
- + Copy Link
@@ -118,21 +109,21 @@ const BlogActionButton = ({data, isDividerShown = true}: {data: any, isDividerSh
- + Share on LinkedIn
- + Share on X
- + Share on Instagram
diff --git a/components/custom/blog/BlogCommentField.tsx b/components/custom/blog/BlogCommentField.tsx new file mode 100644 index 0000000..d173885 --- /dev/null +++ b/components/custom/blog/BlogCommentField.tsx @@ -0,0 +1,46 @@ +import React from 'react'; +import {Card, CardContent, CardFooter, CardHeader} from "@/components/ui/card"; +import {Avatar, Button} from "@nextui-org/react"; +import {useSelector} from "react-redux"; +import {RootState} from "@/state/store"; + +const BlogCommentField = () => { + + const {isAuthenticated} = useSelector((state: RootState) => state.auth); + const {name, profileImage} = useSelector((state: RootState) => state.profile); + + return ( +
+ {isAuthenticated && ( + + +
+ + {name} +
+
+ + +