Skip to content

Commit

Permalink
feat : BlogPostList 없을때 화면
Browse files Browse the repository at this point in the history
  • Loading branch information
f0rever0 committed Oct 28, 2023
1 parent 09d9ff3 commit d443b8c
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/views/BlogPage/BlogPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ export default function BlogPage() {
selectedSubCategory={selectedSubCategory}
setSubCategory={setSubCategory}
/>
<BlogPostList selectedTap={selectedTab} blogPostList={response.data} />
<BlogPostList
selectedTap={selectedTab}
setMajorCategory={setMajorCategory}
setSubCategory={setSubCategory}
blogPostList={response.data}
/>
{(canGetMoreResponse || response._TAG === 'LOADING') && (
<S.SpinnerWrapper ref={canGetMoreResponse ? ref : undefined}>
<OvalSpinner />
Expand Down
28 changes: 26 additions & 2 deletions src/views/BlogPage/components/BlogPostList/index.tsx
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>
);
}
48 changes: 48 additions & 0 deletions src/views/BlogPage/components/BlogPostList/style.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import styled from '@emotion/styled';
import { colors } from '@sopt-makers/colors';

export const BlogPostListWrapper = styled.div`
display: flex;
Expand Down Expand Up @@ -27,3 +28,50 @@ export const BlogPostList = styled.div`
gap: 36px;
}
`;

export const EmptyBlogPostList = styled.section`
color: ${colors.white};
font-size: 32px;
font-weight: 700;
line-height: 48px; /* 150% */
letter-spacing: -0.64px;
margin-top: 78px;
margin-bottom: 24px;
/* 모바일 뷰 */
@media (max-width: 767px) {
font-size: 18px;
line-height: 28px; /* 155.556% */
letter-spacing: -0.36px;
margin-top: 60px;
margin-bottom: 16px;
}
`;

export const Total = styled.button`
background-color: ${colors.gray10};
height: 42px;
padding: 0px 24px;
justify-content: center;
align-items: center;
gap: 10px;
border-radius: 8px;
color: ${colors.gray950};
font-family: SUIT;
font-size: 16px;
font-weight: 600;
line-height: 22px; /* 137.5% */
letter-spacing: -0.32px;
cursor: pointer;
/* 모바일 뷰 */
@media (max-width: 767px) {
height: 36px;
padding: 8px 14px;
font-size: 14px;
line-height: 18px; /* 128.571% */
letter-spacing: -0.28px;
}
`;

0 comments on commit d443b8c

Please sign in to comment.