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

홈화면에서 쓰이는 아티클 리스트 컴포넌트를 추가합니다. #97

Merged
merged 6 commits into from
Sep 13, 2023

Conversation

hhhminme
Copy link
Collaborator

📌 이슈 링크


📖 작업 배경

  • 아티클 리스트를 api 정보로 가져와 보여줍니다.

🛠️ 구현 내용

  • /articles api 함수와 hook을 추가해주었어요.
  • route를 해주지 않는 폴더에 대해 네이밍을 정리해주었어요.
  • 차후 Error boundary를 적용하기 위해 의존성을 설치해주었어요.

💡 참고사항

  • 아직 페이지네이션을 연결하지 않았어요. zustand로 연결해서 만들어보도록할게요.
  • route가 아닌 폴더의 네이밍과 관련하여 next 13 appRouter와 연관지어 설명하지면 아래와 같아요. (3줄요약)
    • next 13 appRouter는 폴더가 하나의 path와 동일하게 router됩니다.
    • 예를 들어 exmaple 라는 폴더가 있을 경우 https://someDomain/example 와 같이 Router를 해주는 폴더인지 눈으로만 보고는 구분이 어렵습니다.
    • 따라서 router 역할을 해주지 않는 폴더에는 앞에 _를 붙이는것이 관례적으로 쓰입니다.
  • css를 찢는게 오히려 기능 붙이는 것보다 작업량이 클 것 같습니다. 기능 붙이기에 집중해서 개발해볼게요.

🖼️ 스크린샷

image

Comment on lines +8 to +12
Object.entries(params).forEach(([key, value]) => {
if (value) {
newSearchParams.append(key, `${value}`);
}
});
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

export interface ArticlesQueryParamsType {
  tag?: string;
  author?: string;
  favorited?: string;
  offset?: number;
  limit?: number;
}

여기에 사용되는 prams 가 길기 때문에 이를 string 으로 직접 넣어주는 것이 아닌 URLSearchParams를 통해 만들어줍니다.

Comment on lines +35 to +43
<ul className="tag-list">
{tagList.map(tag => {
return (
<li className="tag-default tag-pill tag-outline" key={tag}>
{tag}
</li>
);
})}
</ul>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

차후 하단 태그 컴포넌트를 분리하도록 하겠습니다.

Comment on lines +3 to +16
<div className="feed-toggle">
<ul className="nav nav-pills outline-active">
<li className="nav-item">
<a className="nav-link" href="/">
Your Feed
</a>
</li>
<li className="nav-item">
<a className="nav-link active" href="/">
Global Feed
</a>
</li>
</ul>
</div>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

toggle을 추가하였습니다. login 기능연동이 필요할것 같아 로그인 상태를 어떻게 할지 고민해본 다음에 연동해볼게요

Comment on lines +3 to +14
<ul className="pagination">
<li className="page-item active">
<a className="page-link" href="/">
1
</a>
</li>
<li className="page-item">
<a className="page-link" href="/">
2
</a>
</li>
</ul>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

페이지네이션은 tanstack-query-pagenation 을 사용할 수 있지만 Hydration 때 json 직렬화 과정에서 너무 느렸습니다.

상태나 searchParams을 통해 페이지를 관리하고 UseQuery에 바로 넣어줄 예정입니다.

@innocarpe
Copy link
Collaborator

css를 찢는게 오히려 기능 붙이는 것보다 작업량이 클 것 같습니다. 기능 붙이기에 집중해서 개발해볼게요.

이거 정말 장난 아니네요........ ㅋㅋ

@hhhminme hhhminme merged commit bb66312 into pagers-org:team9/hhhminme Sep 13, 2023
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