-
Notifications
You must be signed in to change notification settings - Fork 4
✨ feat: 게시글 상세 댓글ui추가 #364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니다!
function DeleteButton({ id, handleOpen }: { id: number; handleOpen: () => void }) { | ||
return ( | ||
<div className="w-[100%] h-[100%] absolute top-0 left-0 z-[1000] bg-white/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"> | ||
<div className="flex flex-col fixed top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%] w-full max-w-xs md:max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P5) 클래스가 엄청 길군요.. 이걸 조금 완화할 수 있는 방법이 있을지 찾아보면 좋을 것 같아요 !
<div className="bg-gray-50 rounded-lg shadow-sm border border-gray-200 overflow-hidden"> | ||
<div className="p-4"> | ||
<div className="flex items-start gap-3"> | ||
<Avatar className="w-10 h-10"> | ||
<AvatarImage src="https://github.com/shadcn.png" alt="사용자 프로필" /> | ||
<AvatarFallback>CN</AvatarFallback> | ||
</Avatar> | ||
<textarea | ||
placeholder="댓글을 입력하세요..." | ||
className="flex-1 bg-transparent p-2 rounded-md h-20 focus:outline-none focus:ring-2 focus:ring-gray-300 focus:border-transparent resize-none" | ||
></textarea> | ||
</div> | ||
</div> | ||
<div className="flex justify-end px-4 pb-4"> | ||
<button className="bg-primary hover:bg-primary/90 text-white font-medium py-2 px-4 rounded-full transition-colors"> | ||
등록 | ||
</button> | ||
</div> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P4) 지금 컴포넌트가 댓글 작성도 하고, 리스트도 가져오고, 수정도 해서 한 컴포넌트 안에 역할이 많이 있는 것 같아요. 그래서 작성 영역(CommentInput)과 댓글 항목(CommentItem)을 분리하면 각 컴포넌트가 하나의 책임만 가지게 되어 응집도가 높아질 것 같습니다.
특히 댓글 항목은 단순한 UI 반복이 아니라 수정 여부에 따른 조건부 렌더링과 상태 변경 로직을 포함하고 있어서 분리하면 가독성도 좋아지고 유지보수하기 더 쉬울 것 같아요.
export function timeAgo(dateString: string) { | ||
const now = new Date(); | ||
const past = new Date(dateString); | ||
const diff = Number(now) - Number(past); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P5) 파일명과 함수명이 달라요 !
import ShareButton from "@/components/common/Card/detail/ShareButton"; | ||
|
||
import { usePostCardActions } from "@/hooks/common/usePostCardActions"; | ||
|
||
import { POST_COMMENT_DATA } from "@/constants/dummyData"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P5) 혹시 실제로 배포된 페이지에서 댓글이 사용될 때도 dummy data가 쓰이는걸까요?
🔨 테스크
게시글 상세에 댓글 ui추가
댓글 수정
댓글 삭제
📋 작업 내용
📷 스크린 샷