-
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.
- Loading branch information
Showing
23 changed files
with
403 additions
and
84 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
Empty file.
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
File renamed without changes.
61 changes: 61 additions & 0 deletions
61
components/story/detail/comment-item/story-detail-comment-item.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,61 @@ | ||
import React from 'react'; | ||
import DropdownMenu from '@/components/kebab/kebab'; | ||
import { AvatarImage, AvatarName } from '@/components/avatar/avatar'; | ||
import StoryDetailReplyComments from '@/components/story/detail/reply/story-detail-reply-comments'; | ||
import useToggle from '@/hooks/use-toggle'; | ||
import { useDeleteComment } from '@/hooks/queries/story/mutation'; | ||
import { StoryComment } from '@/types/story/details'; | ||
import styles from './story-detail-comment-item.module.scss'; | ||
|
||
interface StoryDetailCommentItemProps extends StoryComment { | ||
onReplyClick: (data: { author: string; replyId: number }) => void; | ||
} | ||
|
||
export default function StoryDetailCommentItem(props: StoryDetailCommentItemProps) { | ||
const { isToggle: isOpen, handleCloseToggle: onCloseToggle, handleOpenToggle: onOpenToggle } = useToggle(); | ||
|
||
const deleteMutation = useDeleteComment(); | ||
|
||
const updateFn = () => { | ||
console.log('Update'); | ||
onCloseToggle(); | ||
}; | ||
|
||
const deleteFn = () => { | ||
deleteMutation.mutate(props.commentId); | ||
onCloseToggle(); | ||
}; | ||
|
||
return ( | ||
<> | ||
<li className={styles['comment-item']}> | ||
<div className={styles['comment-item__info']}> | ||
<AvatarImage image={props.commentsAuthorProfile} /> | ||
<div> | ||
<AvatarName>{props.commentAuthor}</AvatarName> | ||
<time className={styles['comment-item__date']}>2024-06-21</time> | ||
</div> | ||
</div> | ||
<div className={styles['comment-item__contents']}> | ||
<p>{props.comment}</p> | ||
</div> | ||
<button | ||
className={styles['comment-item__reply']} | ||
onClick={props.onReplyClick.bind(null, { author: props.commentAuthor, replyId: props.commentId })} | ||
> | ||
댓글 | ||
</button> | ||
<div className={styles['comment-item__kebab']}> | ||
<DropdownMenu value={{ isOpen, onOpenToggle, onCloseToggle }}> | ||
<DropdownMenu.Kebab color="gray" /> | ||
<DropdownMenu.Content> | ||
<DropdownMenu.Item onClick={updateFn}>수정</DropdownMenu.Item> | ||
<DropdownMenu.Item onClick={deleteFn}>삭제</DropdownMenu.Item> | ||
</DropdownMenu.Content> | ||
</DropdownMenu> | ||
</div> | ||
<StoryDetailReplyComments replyList={props.children} /> | ||
</li> | ||
</> | ||
); | ||
} |
2 changes: 1 addition & 1 deletion
2
.../detail/story-detail-comments.module.scss → ...omments/story-detail-comments.module.scss
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
.wrapper { | ||
margin-top: 12px; | ||
padding: 0 24px 140px 24px; | ||
padding: 0 0px 140px; | ||
border-top: 1px solid #bdbdbd; | ||
} | ||
|
||
|
4 changes: 2 additions & 2 deletions
4
...ts/story/detail/story-detail-comments.tsx → ...detail/comments/story-detail-comments.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
File renamed without changes.
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
61 changes: 61 additions & 0 deletions
61
components/story/detail/reply/story-detail-reply-comment-item.module.scss
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,61 @@ | ||
.comment-item { | ||
position: relative; | ||
margin-top: 20px; | ||
padding: 20px 0 20px 28px; | ||
border-top: 1px solid #eee; | ||
|
||
& + & { | ||
margin-top: 0; | ||
} | ||
} | ||
|
||
.comment-item__info { | ||
display: flex; | ||
gap: 0 8px; | ||
} | ||
|
||
.comment-item__date { | ||
display: block; | ||
font-size: 12px; | ||
color: #d5d9dc; | ||
margin-top: 5px; | ||
} | ||
|
||
.comment-item__contents { | ||
margin-top: 12px; | ||
font-size: 14px; | ||
} | ||
|
||
.comment-item__reply { | ||
margin-top: 10px; | ||
font-size: 12px; | ||
color: #9e9e9e; | ||
} | ||
|
||
.comment-item__kebab { | ||
position: absolute; | ||
right: 0; | ||
top: 20px; | ||
} | ||
|
||
.textarea { | ||
width: 100%; | ||
resize: none; | ||
border-radius: 5px; | ||
padding: 10px; | ||
outline: none; | ||
border: 1px solid var(--main-color); | ||
} | ||
|
||
.reply-form { | ||
position: relative; | ||
|
||
&__button { | ||
font-size: 12px; | ||
text-decoration: underline; | ||
color: var(--main-color); | ||
width: 100%; | ||
text-align: end; | ||
margin-top: 5px; | ||
} | ||
} |
Oops, something went wrong.