11import Image from "next/image" ;
22import { useState } from "react" ;
33
4+ import clsx from "clsx" ;
5+
46import { deleteCommentApi } from "@/services/community" ;
57import { convertISODateToDateTime } from "@/utils/datetimeUtils" ;
68
7- import Dropdown from "@/components/ui/Dropdown" ;
8-
9- import styles from "./comments.module.css" ;
9+ import Dropdown from "@/components/ui/dropdown" ;
1010
1111import { Comment } from "@/types/community" ;
1212
@@ -15,12 +15,11 @@ import { IconMoreVertFilled, IconSubComment } from "@/public/svgs";
1515type CommentsProps = {
1616 comments : Comment [ ] ;
1717 postId : number ;
18- refresh : ( ) => void ;
1918 setCurSelectedComment : React . Dispatch < React . SetStateAction < number | null > > ;
2019 onSuccess : ( ) => void ;
2120} ;
2221
23- const Comments = ( { comments, postId, refresh , setCurSelectedComment, onSuccess } : CommentsProps ) => {
22+ const Comments = ( { comments, postId, setCurSelectedComment, onSuccess } : CommentsProps ) => {
2423 const [ activeDropdown , setActiveDropdown ] = useState < number | null > ( null ) ;
2524
2625 const toggleDeleteComment = ( commentId : number ) => {
@@ -50,12 +49,13 @@ const Comments = ({ comments, postId, refresh, setCurSelectedComment, onSuccess
5049 } ;
5150
5251 return (
53- < div className = { styles [ "comment-container" ] } >
52+ < div className = "h-[50vh] pb-[49px]" >
5453 { comments ?. map ( ( comment ) => (
5554 < div
56- className = { `${ styles [ "comment-wrapper" ] } ${
57- comment . parentId !== null && styles [ "comment-wrapper--sub-comment" ]
58- } `}
55+ className = { clsx (
56+ "flex border-b border-[#ececec] px-5 py-[18px]" ,
57+ comment . parentId !== null ? "bg-[#f2f2f2]" : "bg-[#fafafa]" ,
58+ ) }
5959 key = { comment . id }
6060 role = "button"
6161 tabIndex = { 0 }
@@ -76,15 +76,16 @@ const Comments = ({ comments, postId, refresh, setCurSelectedComment, onSuccess
7676 } }
7777 >
7878 { comment . parentId !== null && (
79- < div className = { styles [ "comment__sub-comment-icon" ] } >
79+ < div className = "mr-1.5" >
8080 < IconSubComment />
8181 </ div >
8282 ) }
83- < div className = { styles . comment } >
84- < div className = { styles [ "comment__first-row" ] } >
85- < div className = { styles . comment__author } >
86- < div className = { styles [ "comment__author-profile-image" ] } >
83+ < div className = "flex w-full flex-col" >
84+ < div className = "flex justify-between" >
85+ < div className = "flex items-center gap-2" >
86+ < div className = "h-[25px] w-[25px] rounded-full bg-[#d9d9d9]" >
8787 < Image
88+ className = "h-full w-full rounded-full"
8889 src = {
8990 comment . postFindSiteUserResponse . profileImageUrl
9091 ? `${ process . env . NEXT_PUBLIC_UPLOADED_IMAGE_URL } /${ comment . postFindSiteUserResponse . profileImageUrl } `
@@ -95,12 +96,14 @@ const Comments = ({ comments, postId, refresh, setCurSelectedComment, onSuccess
9596 alt = "alt"
9697 />
9798 </ div >
98- < div className = { styles [ "comment__author-name" ] } > { comment . postFindSiteUserResponse . nickname } </ div >
99+ < div className = "overflow-hidden text-sm font-medium leading-normal text-black" >
100+ { comment . postFindSiteUserResponse . nickname }
101+ </ div >
99102 </ div >
100103 { comment . isOwner && (
101- < div className = { styles [ "comment__kebab-menu-wrapper" ] } >
104+ < div className = "relative" >
102105 < button
103- className = { styles [ "comment__kebab-menu" ] }
106+ className = "cursor-pointer"
104107 onClick = { ( ) => toggleDropdown ( comment . id ) }
105108 type = "button"
106109 aria-label = "더보기"
@@ -122,9 +125,9 @@ const Comments = ({ comments, postId, refresh, setCurSelectedComment, onSuccess
122125 </ div >
123126 ) }
124127 </ div >
125- < div className = { styles . comment__content } > { comment . content } </ div >
126- < div className = { styles [ "comment__created-at" ] } >
127- { convertISODateToDateTime ( comment . createdAt ) || "1970. 1. 1 . 00:00" }
128+ < div className = "mt-3 text-sm font-normal leading-normal text-black" > { comment . content } </ div >
129+ < div className = "mt-2 overflow-hidden text-xs font-normal leading-normal text-[#7c7c7c]" >
130+ { convertISODateToDateTime ( comment . createdAt ) || "1970. 01. 01 . 00:00" }
128131 </ div >
129132 </ div >
130133 </ div >
0 commit comments