-
Notifications
You must be signed in to change notification settings - Fork 7
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
3 changed files
with
80 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,44 @@ | ||
import { activeGenerationCategoryList } from '@src/lib/constants/tabs'; | ||
import type { BlogPostType } from '@src/lib/types/blog'; | ||
import { PartCategoryType } from '@src/lib/types/blog'; | ||
import BlogPost from '@src/views/BlogPage/components/BlogPost'; | ||
import * as S from './style'; | ||
|
||
interface BlogPostListProps { | ||
selectedTap: string; // REVIEW || ARTICLE | ||
selectedTap: string; // review || article | ||
|
||
blogPostList: BlogPostType[]; | ||
setMajorCategory: (newValue: number) => void; | ||
setSubCategory: (newValue: PartCategoryType) => void; | ||
} | ||
|
||
export default function BlogPostList({ selectedTap, blogPostList }: BlogPostListProps) { | ||
export default function BlogPostList({ | ||
selectedTap, | ||
blogPostList, | ||
setMajorCategory, | ||
setSubCategory, | ||
}: BlogPostListProps) { | ||
const showTotalPostList = () => { | ||
setMajorCategory(activeGenerationCategoryList[0]); | ||
setSubCategory(PartCategoryType.ALL); | ||
}; | ||
return ( | ||
<S.BlogPostListWrapper> | ||
<S.BlogPostList> | ||
{blogPostList?.map((blogPost) => ( | ||
<BlogPost key={blogPost.id} blogPost={blogPost} selectedTap={selectedTap} /> | ||
))} | ||
</S.BlogPostList> | ||
{blogPostList.length === 0 && ( | ||
<> | ||
<S.EmptyBlogPostList> | ||
{`아직 올라온 ${selectedTap === 'article' ? '아티클이' : '활동후기가'} 없어요`} | ||
</S.EmptyBlogPostList> | ||
<S.Total onClick={showTotalPostList}>{`${ | ||
selectedTap === 'article' ? '아티클' : '활동후기' | ||
} 전체 보기`}</S.Total> | ||
</> | ||
)} | ||
</S.BlogPostListWrapper> | ||
); | ||
} |
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