-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Reafctor/projectDetail] �members/techstacks 데이터 형식 변경에 따른 수정
- Loading branch information
Showing
9 changed files
with
89 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/pages/ProjectDetailPage/components/Comments/CommentsItem/components/ReplyButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Button, useMediaQuery } from "@chakra-ui/react" | ||
|
||
import { useCommentContext } from "@pages/ProjectDetailPage/store/CommentContext" | ||
|
||
import CommentsForm from "../../CommentsForm/CommentsForm" | ||
|
||
interface ReplyButtonProps { | ||
parentId?: number | ||
commentId: number | ||
} | ||
|
||
const ReplyButton = ({ parentId, commentId }: ReplyButtonProps) => { | ||
const { replyTargetCommentId, isReply, handleOnReply, handleOffReply } = | ||
useCommentContext() | ||
const [isLargerThan768] = useMediaQuery(["(min-width: 768px)"]) | ||
|
||
return ( | ||
!parentId && | ||
(isReply ? ( | ||
commentId === replyTargetCommentId && ( | ||
<> | ||
<CommentsForm | ||
parentId={replyTargetCommentId} | ||
isReplyComment | ||
/> | ||
<Button | ||
p="0" | ||
_hover={{ opacity: "0.5" }} | ||
fontSize={isLargerThan768 ? "md" : "sm"} | ||
onClick={handleOffReply}> | ||
취소 | ||
</Button> | ||
</> | ||
) | ||
) : ( | ||
<Button | ||
size={isLargerThan768 ? "md" : "sm"} | ||
onClick={() => handleOnReply(commentId)} | ||
_hover={{ opacity: 0.5 }} | ||
p="0"> | ||
답글달기 | ||
</Button> | ||
)) | ||
) | ||
} | ||
|
||
export default ReplyButton |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.