Skip to content
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

Next 정진호 sprint8 #57

Open
wants to merge 6 commits into
base: next-정진호
Choose a base branch
from

Conversation

zinojung
Copy link
Collaborator

요구사항

자유 게시판 페이지

  • 게시글 목록에서 드롭다운을 사용하여 "최신 순"으로 정렬할 수 있도록 합니다.
  • 본인이 이전 미션에서 생성한 게시글 목록 조회 API를 활용해 GET 메서드로 데이터를 가져옵니다.
  • 게시글 제목에 검색어가 일부 포함되면 해당 게시글을 검색할 수 있도록 합니다.
  • 이미지는 디폴트 이미지로 프론트엔드에서 처리해 주세요.
  • 게시글 닉네임 및 좋아요 개수 역시 임의값으로 프론트엔드에서 처리해주세요.
  • 베스트 게시글은 최신순 3개 게시글을 요청으로 데이터를 가져와 구현해주세요.
  • 자유게시판 페이지에서 특정 게시글을 클릭하면 해당 게시물의 상세 페이지로 이동합니다.

게시글 등록 & 수정 페이지

  • 각 input 필드에 정확한 placeholder 값을 입력합니다.
  • 모든 input 필드에 값을 입력하면 '등록' 버튼이 활성화됩니다.
  • 본인이 이전 미션에서 생성한 게시글 생성 API를 활용해 POST 메서드로 게시글을 등록합니다.
  • '등록' 버튼을 누르면 해당 게시물 상세 페이지로 이동합니다.
  • 게시글 수정 페이지 UI는 게시글 등록 페이지와 동일합니다.
  • 본인이 이전 미션에서 생성한 게시글 상세 API의 PATCH 메소드를 사용하여 게시물을 수정합니다.

게시글 상세 페이지

  • 본인이 이전 미션에서 생성한 게시글 상세 API의 GET 메소드를 사용하여 데이터를 가져옵니다.
  • 본인이 이전 미션에서 생성한 게시글 상세 API의 DELETE 메소드를 사용하여 게시물을 삭제합니다.
  • 댓글 input에 값을 입력하면 '등록' 버튼이 활성화됩니다.
  • 본인이 이전 미션에서 생성한 댓글 생성 API를 활용해 POST 메소드로 댓글을 등록합니다.
  • 본인이 이전 미션에서 생성한 댓글 생성 API를 활용해 PATCH 메소드로 댓글을 수정합니다.
  • 본인이 이전 미션에서 생성한 댓글 생성 API를 활용해 DELETE 메소드로 댓글을 삭제합니다.

심화 요구사항

공통

  • 디자인 시안에 따라 반응형 디자인을 구현합니다.
  • (생략 가능) 원한다면 지금까지 진행한 모든 React 코드를 Next.js로 마이그레이션 해주세요.
    • 마이그레이션에 상당한 시간이 소요될 수 있으므로 진행을 권장하지 않습니다.

스크린샷

  • /articles, 자유게시판 화면
image

-/articles/[articleId] 게시글 상페 화면 (댓글 기능 구현 x)
image

  • 게시글 작성하기
image
  • 게시글 수정하기
image

멘토에게

  • 스프린트 5까지 진행하다가 멈춘후, 먼저 스프린트 8부터 구현하였습니다.
    따라서 '홈 화면'과, '상품 화면'은 구현되어 있지 않습니다.

Copy link
Collaborator

@seobew seobew left a comment

Choose a reason for hiding this comment

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

진호님 고생많으셨습니다!

몇가지 코멘트 남겨놨는데, 확인부탁드려요~
이해 안가시는 부분이 있으시면 채널 혹은 멘토링때 물어보셔도 됩니다!

수고하셨습니다~

} = {}) => {
const url = `/products?page=${page}&pageSize=${pageSize}&orderBy=${orderBy}&keyword=${keyword}`;
const response = await client.get(url);
const data = response.data;
Copy link
Collaborator

Choose a reason for hiding this comment

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

이런건 그냥 간결하게 return response.data 로 빼도 될것 같아요~

async function ArticlePage(props) {
const params = await props.params;
const articleId = params.articleId;
const article = await api.getArticle(articleId);
Copy link
Collaborator

Choose a reason for hiding this comment

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

여기서 api를 호출하게되면 해당 api를 받아올떄까지 UI를 그리지 않아 사용자 경험이 안좋을 수 있습니다. useEffect 로 빼서, 로딩이나 초기값을 넣어놓고 렌더후 그다음 업데이트를 하는게 더 나을것 같아요~

import Link from "next/link";
import ArticleComments from "./_components/ArticleComments";
import IconHeart from "@/components/IconHeart";
import DeleteArticleButton from "./_components/DeleteArticleButton";
Copy link
Collaborator

Choose a reason for hiding this comment

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

_components 와 @/components 의 차이가 무엇인가요?? @/components 가 단순히 common 역할을 하는것보다
@/components/common
@/components/articles/DeleteArticleButotn 이렇게 하는게 더 통일성 있을것 같아요

const article = await api.getArticle(articleId);

const isoDate = article.createdAt;
const formattedDate = dayjs(isoDate).format("YYYY.MM.DD");
Copy link
Collaborator

Choose a reason for hiding this comment

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

isoDate로 따로 변수를 빼야하는지는 모르겠습니다. article.createdAt은 한번만 쓰여서요! 차라리 포맷팅을 동일하게 하는 지점들을 찾아 format util 로 빼어 간결하게 하는게 더 좋을것 같습니다!

import React from "react";

function ArticleCard({ item }) {
const isoDate = item.createdAt;
Copy link
Collaborator

Choose a reason for hiding this comment

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

여기도 마찬가지입니다!


const handleSubmit = async (e) => {
e.preventDefault();
if (!title && !content) return;
Copy link
Collaborator

Choose a reason for hiding this comment

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

조건이 둘다 없으면이 아니라 둘중 하나라도 없으면 이 맞을것 같아요~

</div>
<div className="flex flex-col gap-4">
{filteredArticles.map((item) => {
return <ArticleCard key={item.id} item={item} />;
Copy link
Collaborator

Choose a reason for hiding this comment

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

item.id 가 숫자라면 더더욱 unique 키에 걸릴수 있으니 article-${item.id} 같이 사용하는게 더 좋습니다! 같은 페이지에 숫자 키를 쓰는 컴포넌트가 있으면 문제가 되니까요~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants