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

✨ Feat: NoPosts UI 구현 #138

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/pages/posts/Posts.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ const ThemePickerContainer = styled.div`
${({ theme }) => theme.style.flexCenter};
`;

const StyledNoPosts = styled.div`
width: 100%;
height: 300px;
${({ theme }) => theme.style.flexCenter};
color: ${({ theme }) => theme.color.greyLight};
`;

const PostsContainer = styled.div``;

export { StyledPostsPage, ThemePickerContainer, PostsContainer };
export { StyledPostsPage, ThemePickerContainer, PostsContainer, StyledNoPosts };
35 changes: 20 additions & 15 deletions src/pages/posts/Posts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import useObserver from './hooks/useObserver';
import {
StyledPostsPage,
ThemePickerContainer,
PostsContainer
PostsContainer,
StyledNoPosts
} from './Posts.style';
import { useLocation } from 'react-router-dom';
import { CONCENTRATION_KEY } from '@pages/meditation/constants';
Expand Down Expand Up @@ -71,20 +72,24 @@ const Posts = () => {
/>
</ThemePickerContainer>
<PostsContainer ref={postsRef}>
{postsData.map((post: EditedPost, index) => {
const { content, likes, comments } = post;
return (
content && (
<PostPreview
key={index}
post={post}
totalLikes={likes.length}
totalComments={comments.length}
noneProfile={false}
/>
)
);
})}
{postsData.length >= 0 ? (
postsData.map((post: EditedPost, index) => {
const { content, likes, comments } = post;
return (
content && (
<PostPreview
key={index}
post={post}
totalLikes={likes.length}
totalComments={comments.length}
noneProfile={false}
/>
)
);
})
) : (
<StyledNoPosts>현재 발행된 포스트가 없습니다.</StyledNoPosts>
)}
</PostsContainer>
</StyledPostsPage>
);
Expand Down