@@ -6,7 +6,7 @@ import Link from "next/link";
66import KebabDropdown from "../../button/dropdown/KebabDropdown" ;
77import { useRouter } from "next/navigation" ;
88import useModalStore from "@/store/modalStore" ;
9- import { useDeleteComment } from "@/hooks/queries/post/comment/useDeleteComment " ;
9+ import { useDeletePost } from "@/hooks/queries/post/useDeletePost " ;
1010import { useQueryClient } from "@tanstack/react-query" ;
1111
1212const BoardPostItem = ( {
@@ -21,7 +21,7 @@ const BoardPostItem = ({
2121 orderBy : string ;
2222} ) => {
2323 const router = useRouter ( ) ;
24- const deleteComment = useDeleteComment ( String ( post . id ) ) ;
24+ const deletePost = useDeletePost ( String ( post . id ) ) ;
2525 const queryClient = useQueryClient ( ) ;
2626 const { openModal, closeModal } = useModalStore ( ) ;
2727
@@ -33,7 +33,7 @@ const BoardPostItem = ({
3333 confirmText : "삭제하기" ,
3434 cancelText : "취소" ,
3535 onConfirm : ( ) => {
36- deleteComment . mutate ( undefined , {
36+ deletePost . mutate ( undefined , {
3737 onSuccess : async ( ) => {
3838 await queryClient . invalidateQueries ( { queryKey : [ "post" ] } ) ;
3939 await queryClient . invalidateQueries ( { queryKey : [ "myPosts" , { limit, orderBy } ] } ) ;
@@ -59,54 +59,57 @@ const BoardPostItem = ({
5959 ] ;
6060
6161 return (
62- < Link
63- href = { `/work-talk/${ post . id } ` }
64- className = "block cursor-pointer transition-transform duration-300 hover:scale-[1.02]"
65- >
66- < div className = "relative flex h-[202px] min-w-[327px] flex-col justify-between rounded-[16px] border border-line-200 bg-grayscale-50 p-6 shadow-md md:w-[600px] lg:h-[264px] lg:w-full" >
67- < div className = "flex flex-col gap-2" >
68- < h3 className = "line-clamp-1 text-[16px] font-semibold text-black-400 lg:text-[20px]" > { post . title } </ h3 >
69- < p className = "line-clamp-3 overflow-hidden text-[14px] text-grayscale-500 lg:text-[18px]" > { post . content } </ p >
70- </ div >
71-
72- { /* 하단 정보 */ }
73- < div className = "flex items-center justify-between" >
74- < div className = "flex items-center gap-2" >
75- < div className = "flex items-center gap-1" >
76- < Image
77- src = { post . writer . imageUrl || "/icons/user/user-profile-md.svg" }
78- alt = { post . writer . nickname }
79- width = { 24 }
80- height = { 24 }
81- className = "size-6 overflow-hidden rounded-full lg:size-[26px]"
82- />
83- < span className = "text-xs font-medium text-gray-500 lg:text-[16px]" > { post . writer . nickname } </ span >
84- </ div >
85- < span className = "text-line-200" > |</ span >
86- < span className = "text-xs text-grayscale-400 lg:text-[16px]" > { formatLocalDate ( post . updatedAt ) } </ span >
62+ < div className = "relative" >
63+ < Link
64+ href = { `/work-talk/${ post . id } ` }
65+ className = "block cursor-pointer transition-transform duration-300 hover:scale-[1.02]"
66+ >
67+ < div className = "relative flex h-[202px] min-w-[327px] flex-col justify-between rounded-[16px] border border-line-200 bg-grayscale-50 p-6 shadow-md md:w-[600px] lg:h-[264px] lg:w-full" >
68+ < div className = "flex flex-col gap-2" >
69+ < h3 className = "line-clamp-1 text-[16px] font-semibold text-black-400 lg:text-[20px]" > { post . title } </ h3 >
70+ < p className = "line-clamp-3 overflow-hidden text-[14px] text-grayscale-500 lg:text-[18px]" > { post . content } </ p >
8771 </ div >
88- < div className = "ml-3 flex items-center gap-2" >
89- < div className = "flex items-center" >
90- < Image
91- src = "/icons/comment/comment-md.svg"
92- alt = "댓글"
93- width = { 20 }
94- height = { 20 }
95- className = "size-6 lg:size-9"
96- />
97- < span className = "text-xs text-grayscale-400 lg:text-[16px]" > { post . commentCount } </ span >
72+
73+ { /* 하단 정보 */ }
74+ < div className = "flex items-center justify-between" >
75+ < div className = "flex items-center gap-2" >
76+ < div className = "flex items-center gap-1" >
77+ < Image
78+ src = { post . writer . imageUrl || "/icons/user/user-profile-md.svg" }
79+ alt = { post . writer . nickname }
80+ width = { 24 }
81+ height = { 24 }
82+ className = "size-6 overflow-hidden rounded-full lg:size-[26px]"
83+ />
84+ < span className = "text-xs font-medium text-gray-500 lg:text-[16px]" > { post . writer . nickname } </ span >
85+ </ div >
86+ < span className = "text-line-200" > |</ span >
87+ < span className = "text-xs text-grayscale-400 lg:text-[16px]" > { formatLocalDate ( post . updatedAt ) } </ span >
9888 </ div >
99- < div className = "flex items-center" >
100- < Image src = "/icons/like/like-md.svg" alt = "좋아요" width = { 20 } height = { 20 } className = "size-6 lg:size-9" />
101- < span className = "text-xs text-grayscale-400 lg:text-[16px]" > { post . likeCount } </ span >
89+ < div className = "ml-3 flex items-center gap-2" >
90+ < div className = "flex items-center" >
91+ < Image
92+ src = "/icons/comment/comment-md.svg"
93+ alt = "댓글"
94+ width = { 20 }
95+ height = { 20 }
96+ className = "size-6 lg:size-9"
97+ />
98+ < span className = "text-xs text-grayscale-400 lg:text-[16px]" > { post . commentCount } </ span >
99+ </ div >
100+ < div className = "flex items-center" >
101+ < Image src = "/icons/like/like-md.svg" alt = "좋아요" width = { 20 } height = { 20 } className = "size-6 lg:size-9" />
102+ < span className = "text-xs text-grayscale-400 lg:text-[16px]" > { post . likeCount } </ span >
103+ </ div >
102104 </ div >
103105 </ div >
104106 </ div >
105- < div className = "absolute right-3 top-6 size-9 bg-white text-center" onClick = { ( e ) => e . stopPropagation ( ) } >
106- { isAuthor && < KebabDropdown options = { dropdownOptions } /> }
107- </ div >
107+ </ Link >
108+ < div className = "absolute right-3 top-6 size-9 bg-white text-center" >
109+ { isAuthor && < KebabDropdown options = { dropdownOptions } /> }
108110 </ div >
109- </ Link >
111+ </ div >
110112 ) ;
111113} ;
114+
112115export default BoardPostItem ;
0 commit comments