Skip to content

Conversation

@jaehyeongjung
Copy link
Collaborator

@jaehyeongjung jaehyeongjung commented Jan 13, 2025

요구사항

기본

  • 자유 게시판 페이지 주소는 “/boards” 입니다.
  • 전체 게시글에서 드롭 다운으로 “최신 순” 또는 “좋아요 순”을 선택해서 정렬을 할 수 있습니다.
  • 게시글 목록 조회 api를 사용하여 베스트 게시글, 게시글을 구현합니다.
  • 게시글 title에 검색어가 일부 포함되면 검색이 됩니다.

심화

심화

  • 반응형으로 보여지는 베스트 게시판 개수를 다르게 설정할때 서버에 보내는 pageSize값을 적절하게 설정합니다.
  • next의 prefetch 기능을 사용해봅니다.

주요 변경사항

  • 반응형은 시간이 부족해 건드리지 못했습니다.

스크린샷

  • 스크린샷 2025-01-14 오전 12 04 30
스크린샷 2025-01-14 오전 12 04 40 스크린샷 2025-01-14 오전 12 05 05

멘토에게

  • 이번 주말은 개인적인 사정으로 너무 바빠서 늦게라도 제출합니다 ㅜㅜ

@jaehyeongjung jaehyeongjung added the 순한맛🐑 마음이 많이 여립니다.. label Jan 13, 2025
@jaehyeongjung jaehyeongjung changed the title Next 정재형 sprint9 정재형 [sprint9] Jan 13, 2025
@jaehyeongjung jaehyeongjung self-assigned this Jan 13, 2025
@devToram
Copy link
Collaborator

커밋 메시지 너무 깔끔하네요.. 👍

Copy link
Collaborator

@devToram devToram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다 👍

Copy link
Collaborator

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 여도 괜찮을 거 같아요!

Copy link
Collaborator Author

@jaehyeongjung jaehyeongjung Jan 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

       � BestPost 폴더 > bestPost.tsx (소문자시작) 
                              > index.module.css 이렇게 수정하라는 말씀이실까요 ?

  만약 그러면 그 외에 Dropdown폴더의 경우에도 
Dropdown.module.css , Dropdown.tsx 에서 -> index.module.css, Dropdown.tsx(컴포넌트)가 적절한가요 ?

.BestPostTitle {
width: 109px;
height: 24px;
font-family: Pretendard;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요거 아마 기본일거라 안적어도 될 거에요! (기본 아니면 global.css 에서 선언하면 될 거 같아요)

import Image from "next/image";

export default function BestPost() {
const [articles, setArticles] = useState<any[]>([]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Article 타입 선언해서 쓰면 좋을 거 같아요!

<div className={styles.BestPost}>
<div className={styles.BestPostTitle}>베스트 게시글</div>
<div className={styles.BestPostTopic}>
{articles.map((article) => (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{articles.map((article) => (
{articles.map(({content, likeCount ... }) => (

요런 식으로 구조분해할당하면 좋을 거 같아요!

<div className={styles.BestPostTitle}>베스트 게시글</div>
<div className={styles.BestPostTopic}>
{articles.map((article) => (
<div className={styles.BestPostTopicMap}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기 key props 추가해주세요!

Suggested change
<div className={styles.BestPostTopicMap}>
<div className={styles.BestPostTopicMap} key={index}>


const Dropdown: React.FC<DropdownProps> = ({ onChange }) => {
const [isOpen, setIsOpen] = useState(false);
const [selectedOption, setSelectedOption] = useState("최신순"); // 선택된 항목 저장
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요것도 string 으로 추정될 거라서 타입 정의해주면 좋을 거 같아요!
type Option = "최신순" | "인기순"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enum 으로 해줘도 좋을 거 같아요!

}

.HeaderLogoText {
font-family: "ROKAFSans", sans-serif !important;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!important 는 정말 최소한으로만 사용하는 게 좋아서 안쓸 수 있는 방법이 있는 지 고민해주세요!

const [articles, setArticles] = useState([]);
const [orderBy, setOrderBy] = useState("recent");
const [searchQuery, setSearchQuery] = useState(""); // 검색어 상태 추가
const [filteredArticles, setFilteredArticles] = useState([]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

멘토링때 말씀드렸던 것처럼 useMemo 사용하는 방식도 고민해주셔요!

</div>
<div className={styles.PostCommentSection}>
{filteredArticles.map((article) => (
<div className={styles.PostCommentMap}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기도 key props 넘겨주세요~

@devToram devToram merged commit e1bddf4 into codeit-bootcamp-frontend:Next-정재형 Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

순한맛🐑 마음이 많이 여립니다..

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants