-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Minor : Box 컴포넌트 Stack컴포넌트로 교체 * New : 댓글 컴포넌트 제작 * New : 댓글 리스트 컴포넌트 제작 * New : 댓글 리스트 컴포넌트 반영
- Loading branch information
1 parent
5ccd959
commit 85dffbd
Showing
4 changed files
with
101 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { USER_PAGE } from "@/const/clientPath"; | ||
import { Stack, Avatar, Typography } from "@mui/material"; | ||
import dayjs from "dayjs"; | ||
import Link from "next/link"; | ||
|
||
type Props = { | ||
content: string; | ||
nickname: string; | ||
userId: string; | ||
userPk: string; | ||
createdAt: string; | ||
}; | ||
|
||
const PostComment = ({ | ||
content, | ||
nickname, | ||
userId, | ||
createdAt, | ||
userPk, | ||
}: Props) => { | ||
return ( | ||
<Stack direction="row" gap={1.25}> | ||
<Avatar /> | ||
<Stack gap={1}> | ||
<Stack direction="row" gap={1}> | ||
<Link href={USER_PAGE(userPk)}> | ||
<Typography>{nickname}</Typography> | ||
</Link> | ||
<Link href={USER_PAGE(userPk)}> | ||
<Typography | ||
variant="label" | ||
color={"text.secondary"} | ||
>{`@${userId}`}</Typography> | ||
</Link> | ||
<Typography variant="label" color={"text.secondary"}> | ||
{dayjs(createdAt).format("MM.DD")} | ||
</Typography> | ||
</Stack> | ||
<Typography>{content}</Typography> | ||
</Stack> | ||
</Stack> | ||
); | ||
}; | ||
|
||
export default PostComment; |
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,40 @@ | ||
import PostComment from "./PostComment"; | ||
import { Card, Stack } from "@mui/material"; | ||
|
||
type Props = { | ||
postNo: string; | ||
}; | ||
|
||
const PostCommentList = ({ postNo }: Props) => { | ||
const comments = Array.from(new Array(4)).map((_e, i) => ({ | ||
commentNo: i, | ||
comment: | ||
"Lorem ipsum dolor sit amet consectetur adipisicing elit. Repellendus laudantium enim veritatis minus excepturi. Quidem iusto, velit facilis corporis at suscipit minima sed, cumque nostrum fugiat ad natus? Voluptatum, odio?", | ||
createdAt: new Date(), | ||
nickname: "유저이름", | ||
userId: "유저유저아이디", | ||
})); | ||
return ( | ||
comments && | ||
comments.length > 0 && ( | ||
<Card sx={{ display: "flex", gap: 2, p: 2 }}> | ||
<Stack gap={2}> | ||
{comments.map( | ||
({ commentNo, comment, createdAt, nickname, userId }, i) => ( | ||
<PostComment | ||
content={comment} | ||
createdAt={String(createdAt)} | ||
nickname={nickname} | ||
userId={userId} | ||
userPk={String(i)} | ||
key={commentNo} | ||
/> | ||
) | ||
)} | ||
</Stack> | ||
</Card> | ||
) | ||
); | ||
}; | ||
|
||
export default PostCommentList; |
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