-
Notifications
You must be signed in to change notification settings - Fork 39
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
25 changed files
with
637 additions
and
53 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
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,42 @@ | ||
.comment-form-container { | ||
width: 1200px; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 9px; | ||
label { | ||
font-weight: 600; | ||
font-size: 16px; | ||
color: var(--gray900); | ||
} | ||
textarea { | ||
height: 104px; | ||
padding: 16px 24px; | ||
background-color: var(--gray100); | ||
border: none; | ||
border-radius: 12px; | ||
resize: none; | ||
&::placeholder { | ||
font-weight: 400; | ||
font-size: 16px; | ||
color: var(--gray400); | ||
} | ||
&:focus { | ||
outline: none; | ||
} | ||
} | ||
button { | ||
width: 74px; | ||
height: 42px; | ||
border: none; | ||
border-radius: 8px; | ||
background-color: var(--blue); | ||
color: var(--gray100); | ||
font-weight: 600; | ||
font-size: 16px; | ||
margin-left: auto; | ||
&:disabled { | ||
background-color: var(--gray400); | ||
cursor: not-allowed; | ||
} | ||
} | ||
} |
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,25 @@ | ||
import React, { useState } from "react"; | ||
import styles from "./CommentForm.module.scss"; | ||
|
||
const CommentForm = () => { | ||
const [content, setContent] = useState(""); | ||
|
||
const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => { | ||
setContent(e.target.value); | ||
}; | ||
return ( | ||
<form className={styles["comment-form-container"]}> | ||
<label htmlFor="comment">댓글달기</label> | ||
<textarea | ||
name="comment" | ||
id="comment" | ||
value={content} | ||
onChange={handleChange} | ||
placeholder="댓글을 입력해주세요" | ||
/> | ||
<button disabled={!content}>등록</button> | ||
</form> | ||
); | ||
}; | ||
|
||
export default CommentForm; |
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
52 changes: 52 additions & 0 deletions
52
components/PostDetailSection/PostDetailSection.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,52 @@ | ||
.post-detail-section-container { | ||
width: 1200px; | ||
margin-top: 102px; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 16px; | ||
.post-detail-section-title { | ||
font-weight: 700; | ||
font-size: 20px; | ||
} | ||
.post-detail-section-info { | ||
display: flex; | ||
align-items: center; | ||
padding-bottom: 16px; | ||
border-bottom: 1px solid var(--gray200); | ||
.post-detail-section-profile-image { | ||
margin-right: 16px; | ||
} | ||
.post-detail-section-info-name { | ||
font-weight: 500; | ||
font-size: 14px; | ||
color: var(--gray600); | ||
margin-right: 8px; | ||
} | ||
.post-detail-section-info-date { | ||
font-weight: 400; | ||
font-size: 14px; | ||
color: var(--gray400); | ||
padding-right: 32px; | ||
border-right: 1px solid var(--gray200); | ||
} | ||
.post-detail-section-info-likes { | ||
margin-left: 32px; | ||
display: flex; | ||
align-items: center; | ||
height: 40px; | ||
border: 1px solid var(--gray200); | ||
border-radius: 35px; | ||
padding: 4px 12px; | ||
span { | ||
font-weight: 500; | ||
font-size: 16px; | ||
color: var(--gray500); | ||
} | ||
} | ||
} | ||
.post-detail-section-content { | ||
margin-top: 8px; | ||
font-weight: 400; | ||
font-size: 18px; | ||
} | ||
} |
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,68 @@ | ||
import React from "react"; | ||
import styles from "./PostDetailSection.module.scss"; | ||
import Image from "next/image"; | ||
import profileIcon from "public/ic_profile.svg"; | ||
import heartIcon from "public/ic_heart.svg"; | ||
|
||
interface PostItem { | ||
content: string; | ||
image?: string; | ||
likeCount: number; | ||
title: string; | ||
createdAt: string; | ||
writer: { | ||
nickname: string; | ||
}; | ||
} | ||
|
||
const PostDetailSection = ({ item }: { item: PostItem }) => { | ||
const { | ||
content, | ||
image, | ||
likeCount, | ||
createdAt, | ||
title, | ||
writer: { nickname }, | ||
} = item; | ||
|
||
const formatDate = (dateString: string) => { | ||
const dateObj = new Date(dateString); | ||
const year = dateObj.getFullYear(); | ||
const month = String(dateObj.getMonth() + 1).padStart(2, "0"); | ||
const day = String(dateObj.getDate()).padStart(2, "0"); | ||
return `${year}.${month}.${day}`; | ||
}; | ||
|
||
return ( | ||
<div className={styles["post-detail-section-container"]}> | ||
<h1 className={styles["post-detail-section-title"]}>{title}</h1> | ||
<div className={styles["post-detail-section-info"]}> | ||
<Image | ||
src={profileIcon} | ||
alt="프로필을 나타내는 아이콘" | ||
width={40} | ||
height={40} | ||
className={styles["post-detail-section-profile-image"]} | ||
/> | ||
<span className={styles["post-detail-section-info-name"]}> | ||
{nickname} | ||
</span> | ||
<span className={styles["post-detail-section-info-date"]}> | ||
{formatDate(createdAt)} | ||
</span> | ||
<span className={styles["post-detail-section-info-likes"]}> | ||
<Image | ||
src={heartIcon} | ||
alt="좋아요를 나타내는 하트모양의 아이콘" | ||
width={32} | ||
height={32} | ||
/> | ||
<span>{likeCount}</span> | ||
</span> | ||
</div> | ||
<p className={styles["post-detail-section-content"]}>{content}</p> | ||
</div> | ||
); | ||
}; | ||
|
||
export default PostDetailSection; |
Oops, something went wrong.