-
Notifications
You must be signed in to change notification settings - Fork 37
정재형 [sprint9] #293
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
The head ref may contain hidden characters: "Next-\uC815\uC7AC\uD615-sprint9"
정재형 [sprint9] #293
Changes from all commits
5be97cc
015c332
55676e0
ffc240f
be2099c
5d050f3
cc43d1b
efc7ea0
232aea1
0646f61
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| next.config.js |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,33 @@ | ||
| { | ||
| "extends": "next/core-web-vitals" | ||
| "env": { | ||
| "browser": true, | ||
| "node": true, | ||
| "es2021": true | ||
| }, | ||
| "extends": [ | ||
| "eslint:recommended", | ||
| "plugin:react/recommended", | ||
| "plugin:@typescript-eslint/recommended", | ||
| "next/core-web-vitals" | ||
| ], | ||
| "parser": "@typescript-eslint/parser", | ||
| "parserOptions": { | ||
| "ecmaVersion": 12, | ||
| "sourceType": "module", | ||
| "project": "./tsconfig.json" | ||
| }, | ||
| "plugins": ["react", "react-hooks", "@typescript-eslint"], | ||
| "rules": { | ||
| "no-console": "warn", | ||
| "semi": ["error", "always"], | ||
| "quotes": ["error", "single"] | ||
| }, | ||
| "overrides": [ | ||
| { | ||
| "files": ["next.config.js"], | ||
| "rules": { | ||
| "@typescript-eslint/explicit-module-boundary-types": "off" | ||
| } | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,167 @@ | ||
| .BestPostContainer { | ||
| width: 1200px; | ||
| height: 241px; | ||
| margin: 0 auto; | ||
| margin-top: 24px; | ||
| } | ||
|
|
||
| .BestPost { | ||
| width: 100%; | ||
| height: 217px; | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 24px; | ||
| } | ||
|
|
||
| .BestPostTitle { | ||
| width: 109px; | ||
| height: 24px; | ||
| font-family: Pretendard; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 요거 아마 기본일거라 안적어도 될 거에요! (기본 아니면 global.css 에서 선언하면 될 거 같아요) |
||
| font-size: 20px; | ||
| font-weight: 700; | ||
| line-height: 23.87px; | ||
| text-align: left; | ||
| color: #111827; | ||
| white-space: nowrap; | ||
| } | ||
|
|
||
| .BestPostTopic { | ||
| width: 100%; | ||
| height: 169px; | ||
| display: flex; | ||
| gap: 24px; | ||
| } | ||
|
|
||
| .BestPostTopicMap { | ||
| width: 384px; | ||
| height: 169px; | ||
| border-radius: 8px; | ||
| background-color: #f9fafb; | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 24px; | ||
| } | ||
|
|
||
| .BestTopicImg { | ||
| width: 102px; | ||
| height: 30px; | ||
| background-color: #3692ff; | ||
| border-radius: 0px 0px 16px 16px; | ||
| margin-left: 24px; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| } | ||
|
|
||
| .BestTopicContentImg img { | ||
| width: 100%; | ||
| height: 100%; | ||
| object-fit: cover; | ||
| } | ||
|
|
||
| .BestTopicContent { | ||
| width: 336px; | ||
| height: 72px; | ||
| margin: 0 auto; | ||
| display: flex; | ||
| gap: 8px; | ||
| } | ||
|
|
||
| .BestTopicDetail { | ||
| width: 336px; | ||
| height: 24px; | ||
| margin: 0 auto; | ||
| display: flex; | ||
| justify-content: space-between; | ||
| } | ||
|
|
||
| .BestTopicContentText { | ||
| width: 256px; | ||
| height: 64px; | ||
| font-family: Pretendard; | ||
| font-size: 20px; | ||
| font-weight: 600; | ||
| line-height: 32px; | ||
| text-align: left; | ||
| overflow: hidden; | ||
| text-overflow: ellipsis; | ||
| } | ||
|
|
||
| .BestTopicContentImg { | ||
| width: 72px; | ||
| height: 72x; | ||
| border-radius: 6px; | ||
| border: 1px solid #e5e7eb; | ||
| } | ||
|
|
||
| .BestTopicDetailData { | ||
| width: 133px; | ||
| height: 24px; | ||
| display: flex; | ||
| gap: 8px; | ||
| } | ||
|
|
||
| .BestTopicDetailDate { | ||
| width: 79px; | ||
| height: 24px; | ||
| font-family: Pretendard; | ||
| font-size: 14px; | ||
| font-weight: 400; | ||
| line-height: 24px; | ||
| text-align: left; | ||
| color: #9ca3af; | ||
| } | ||
|
|
||
| .BestTopicImgInner { | ||
| display: flex; | ||
| height: 26px; | ||
| width: 54px; | ||
| gap: 4px; | ||
| align-items: center; | ||
| } | ||
|
|
||
| .BestPostTopicImgInnerText { | ||
| width: 34px; | ||
| height: 26px; | ||
| font-family: Pretendard; | ||
| font-size: 16px; | ||
| font-weight: 600; | ||
| color: white; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| padding-top: 3px; | ||
| line-height: normal; | ||
| text-align: center; | ||
| } | ||
|
|
||
| .BestTopicDetailDataNickname { | ||
| width: 61px; | ||
| height: 100%; | ||
| white-space: nowrap; | ||
| font-family: Pretendard; | ||
| font-size: 14px; | ||
| font-weight: 400; | ||
| line-height: 24px; | ||
| text-align: left; | ||
| } | ||
|
|
||
| .BestTopicDetailDataFavorite { | ||
| display: flex; | ||
| align-items: center; | ||
| width: 64px; | ||
| height: 100%; | ||
| gap: 4px; | ||
| } | ||
|
|
||
| .BestTopicDetailDataFavoriteNum { | ||
| width: 44px; | ||
| height: 100%; | ||
| font-family: Pretendard; | ||
| font-size: 14px; | ||
| font-weight: 400; | ||
| text-align: left; | ||
| color: #6b7280; | ||
| display: flex; | ||
| align-items: center; | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,99 @@ | ||||||
| import styles from "./BestPost.module.css"; | ||||||
| import medal from "@/public/medal.svg"; | ||||||
| import React, { useState, useEffect } from "react"; // React import 추가 | ||||||
| import heart from "@/public/heart.svg"; | ||||||
| import Image from "next/image"; | ||||||
|
|
||||||
| export default function BestPost() { | ||||||
| const [articles, setArticles] = useState<any[]>([]); | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Article 타입 선언해서 쓰면 좋을 거 같아요! |
||||||
|
|
||||||
| useEffect(() => { | ||||||
| const fetchArticles = async () => { | ||||||
| const response = await fetch("/api/BestApi"); | ||||||
| const data = await response.json(); | ||||||
| setArticles(data.list || []); // API에서 받은 데이터를 상태에 저장 | ||||||
| }; | ||||||
|
|
||||||
| fetchArticles(); | ||||||
| }, []); | ||||||
|
|
||||||
| return ( | ||||||
| <> | ||||||
| <div className={styles.BestPostContainer}> | ||||||
| <div className={styles.BestPost}> | ||||||
| <div className={styles.BestPostTitle}>베스트 게시글</div> | ||||||
| <div className={styles.BestPostTopic}> | ||||||
| {articles.map((article) => ( | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
요런 식으로 구조분해할당하면 좋을 거 같아요! |
||||||
| <div className={styles.BestPostTopicMap}> | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 여기 key props 추가해주세요!
Suggested change
|
||||||
| <div className={styles.BestTopicImg}> | ||||||
| <div className={styles.BestTopicImgInner}> | ||||||
| <Image | ||||||
| src={medal} | ||||||
| alt="medal" | ||||||
| width={16} | ||||||
| height={16} | ||||||
| /> | ||||||
| <p | ||||||
| className={ | ||||||
| styles.BestPostTopicImgInnerText | ||||||
| } | ||||||
| > | ||||||
| Best | ||||||
| </p> | ||||||
| </div> | ||||||
| </div> | ||||||
| <div className={styles.BestTopicContent}> | ||||||
| <div | ||||||
| className={styles.BestTopicContentText} | ||||||
| > | ||||||
| {article.content} | ||||||
| </div> | ||||||
| <div | ||||||
| className={styles.BestTopicContentImg} | ||||||
| > | ||||||
| <img src={article.image}></img> | ||||||
| </div> | ||||||
| </div> | ||||||
| <div className={styles.BestTopicDetail}> | ||||||
| <div className={styles.BestTopicDetailData}> | ||||||
| <div | ||||||
| className={ | ||||||
| styles.BestTopicDetailDataNickname | ||||||
| } | ||||||
| > | ||||||
| {article.writer.nickname} | ||||||
| </div> | ||||||
| <div | ||||||
| className={ | ||||||
| styles.BestTopicDetailDataFavorite | ||||||
| } | ||||||
| > | ||||||
| <Image | ||||||
| src={heart} | ||||||
| alt="heart" | ||||||
| width={16} | ||||||
| height={16} | ||||||
| /> | ||||||
| <div | ||||||
| className={ | ||||||
| styles.BestTopicDetailDataFavoriteNum | ||||||
| } | ||||||
| > | ||||||
| {article.likeCount} | ||||||
| </div> | ||||||
| </div> | ||||||
| </div> | ||||||
| <div className={styles.BestTopicDetailDate}> | ||||||
| {new Date( | ||||||
| article.createdAt | ||||||
| ).toLocaleDateString()} | ||||||
| </div> | ||||||
| </div> | ||||||
| </div> | ||||||
| ))} | ||||||
| </div> | ||||||
| </div> | ||||||
| </div> | ||||||
| </> | ||||||
| ); | ||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| .dropdownContainer { | ||
| border: 1px solid #e5e7eb; | ||
| border-radius: 12px; | ||
| width: 130px; | ||
| height: 42px; | ||
| position: relative; | ||
| padding-left: 24px; | ||
| padding-top: 12px; | ||
| } | ||
|
|
||
| .dropdownButton { | ||
| width: 90px; | ||
| height: 18px; | ||
| display: flex; | ||
| justify-content: space-between; | ||
| align-items: center; | ||
| border: none; | ||
| background-color: white; | ||
|
|
||
| } | ||
| .dropdownMenu ul { | ||
| list-style-type: none; /* 동그라미 점 제거 */ | ||
| padding: 0; /* 기본 padding 제거 */ | ||
| margin: 0; /* 기본 margin 제거 */ | ||
| } | ||
|
|
||
| .dropdownMenu { | ||
| display: block; | ||
| } | ||
|
|
||
| .dropdownItem { | ||
| width: 90px; | ||
| height: 23px; | ||
| font-family: Pretendard; | ||
| font-size: 14px; | ||
| font-weight: 400; | ||
| line-height: 26px; | ||
| text-align: left; | ||
| border: 1px solid #e5e7eb; | ||
| background-color: floralwhite; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| border-bottom: 1px solid #e5e7eb; /* 항목 간 구분선 추가 */ | ||
| } | ||
|
|
||
| .text { | ||
| font-family: Pretendard; | ||
| font-size: 16px; | ||
| font-weight: 400; | ||
| line-height: 26px; | ||
| text-align: left; | ||
| } |
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.
대문자로 시작하는 파일은 컴포넌트에만 써주시는 게 좋아요! css 파일은 소문자로 시작하는 걸 추천드려요!
bestPost.module.css그리고 폴더 이름이 BestPost 인만큼
index.module.css여도 괜찮을 거 같아요!Uh oh!
There was an error while loading. Please reload this page.
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.