From 774d925d9f2f32a34ba0f1ecfe7337caa41162e0 Mon Sep 17 00:00:00 2001 From: HyunJinNo Date: Fri, 30 Aug 2024 16:50:29 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=EC=A0=95=EB=B3=B4=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=EB=84=A4=EC=9D=B4=EC=85=98=EC=97=90=EC=84=9C=20tagNam?= =?UTF-8?q?e=EC=9D=B4=20=EC=9C=A0=EC=A7=80=EB=90=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../informations/detail/InformationLikeCount.tsx | 13 +++++++++++-- .../informations/list/InformationPagination.tsx | 16 +++++++++------- .../informations/list/InformationSearch.tsx | 6 +++--- .../detail/InformationLikeCountContainer.tsx | 5 +++-- .../list/InformationFilterModalContainer.tsx | 3 ++- .../list/InformationPaginationContainer.tsx | 1 + 6 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/components/informations/detail/InformationLikeCount.tsx b/src/components/informations/detail/InformationLikeCount.tsx index 539a83bf..f4b01460 100644 --- a/src/components/informations/detail/InformationLikeCount.tsx +++ b/src/components/informations/detail/InformationLikeCount.tsx @@ -2,20 +2,29 @@ import HashSpinner from "@/components/common/HashSpinner"; import { FaHeart, FaRegHeart } from "react-icons/fa"; interface Props { + clickable: boolean; loading: boolean; likeCount: number; isLiked: boolean; onLikesClick: () => void; } -// hover:text-[#F85E5E] - const InformationLikeCount = ({ + clickable, loading, likeCount, isLiked, onLikesClick, }: Props) => { + if (!clickable) { + return ( +
+ +

{likeCount}

+
+ ); + } + return (
diff --git a/src/components/informations/list/InformationPagination.tsx b/src/components/informations/list/InformationPagination.tsx index 13c4e988..c555744f 100644 --- a/src/components/informations/list/InformationPagination.tsx +++ b/src/components/informations/list/InformationPagination.tsx @@ -11,6 +11,7 @@ interface Props { childCategoryId: string | null; place: string | null; order: string | null; + tagName: string | null; } const InformationPagination = ({ @@ -21,6 +22,7 @@ const InformationPagination = ({ childCategoryId, place, order, + tagName, }: Props) => { const pageList = Array.from({ length: totalPages }, (_, index) => index + 1); const leftPage = Math.max(currentPage - 2, 1); @@ -30,7 +32,7 @@ const InformationPagination = ({
{currentPage > 1 ? ( 1 ? ( @@ -53,7 +55,7 @@ const InformationPagination = ({
1 @@ -64,7 +66,7 @@ const InformationPagination = ({ {pageNumber} @@ -74,7 +76,7 @@ const InformationPagination = ({ {totalPages} @@ -82,7 +84,7 @@ const InformationPagination = ({ )} {currentPage < totalPages ? ( @@ -91,7 +93,7 @@ const InformationPagination = ({ )} {currentPage < totalPages ? ( 최신순 좋아요순 조회순 diff --git a/src/containers/informations/detail/InformationLikeCountContainer.tsx b/src/containers/informations/detail/InformationLikeCountContainer.tsx index fb3099fc..ebe7169d 100644 --- a/src/containers/informations/detail/InformationLikeCountContainer.tsx +++ b/src/containers/informations/detail/InformationLikeCountContainer.tsx @@ -1,6 +1,7 @@ "use client"; import InformationLikeCount from "@/components/informations/detail/InformationLikeCount"; +import useAuthStore from "@/store/authStore"; import useInformationLikeStore from "@/store/informationLikeStore"; import { useEffect, useState } from "react"; @@ -15,8 +16,7 @@ const InformationLikeCountContainer = ({ likeCount, isLike, }: Props) => { - // const [likes, setLikes] = useState(likeCount); - // const [isLiked, setIsLiked] = useState(isLike); + const userId = useAuthStore().id; const informationLikeStore = useInformationLikeStore(); const [loading, setLoading] = useState(false); @@ -81,6 +81,7 @@ const InformationLikeCountContainer = ({ return ( 0} loading={loading} likeCount={informationLikeStore.likeCount} isLiked={informationLikeStore.isLiked} diff --git a/src/containers/informations/list/InformationFilterModalContainer.tsx b/src/containers/informations/list/InformationFilterModalContainer.tsx index 3f1fb012..cddba145 100644 --- a/src/containers/informations/list/InformationFilterModalContainer.tsx +++ b/src/containers/informations/list/InformationFilterModalContainer.tsx @@ -14,12 +14,13 @@ const InformationFilterModalContainer = ({ closeModal }: Props) => { const childCategoryId = searchParams.get("childCategoryId"); const [place, setPlace] = useState(searchParams.get("place")); const order = searchParams.get("order") ?? "latest"; + const tagName = searchParams.get("tagName"); const router = useRouter(); const pathname = usePathname(); const onClick = () => { router.push( - `${pathname}?page=1&parentCategoryId=${parentCategoryId}${childCategoryId !== null ? `&childCategoryId=${childCategoryId}` : ""}${place !== null ? `&place=${place}` : ""}&order=${order}`, + `${pathname}?page=1&parentCategoryId=${parentCategoryId}${childCategoryId !== null ? `&childCategoryId=${childCategoryId}` : ""}${place !== null ? `&place=${place}` : ""}&order=${order}${tagName !== null ? `&tagName=${tagName}` : ""}`, { scroll: false, }, diff --git a/src/containers/informations/list/InformationPaginationContainer.tsx b/src/containers/informations/list/InformationPaginationContainer.tsx index b8d3fa6c..ce508a60 100644 --- a/src/containers/informations/list/InformationPaginationContainer.tsx +++ b/src/containers/informations/list/InformationPaginationContainer.tsx @@ -21,6 +21,7 @@ const InformationPaginationContainer = ({ currentPage, totalPages }: Props) => { childCategoryId={searchParams.get("childCategoryId")} place={searchParams.get("place")} order={searchParams.get("order")} + tagName={searchParams.get("tagName")} /> ); };