File tree Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,9 @@ import PostCardList, {
5
5
import { GET_POST_LIST , PartialPost } from '../../lib/graphql/post' ;
6
6
import { useQuery } from '@apollo/react-hooks' ;
7
7
import PaginateWithScroll from '../../components/common/PaginateWithScroll' ;
8
+ import { undrawBlankCanvas } from '../../static/images' ;
9
+ import palette from '../../lib/styles/palette' ;
10
+ import styled from 'styled-components' ;
8
11
9
12
interface UserPostsProps {
10
13
username : string ;
@@ -45,11 +48,37 @@ const UserPosts: React.FC<UserPostsProps> = ({ username }) => {
45
48
46
49
return (
47
50
< >
48
- < PostCardList posts = { data . posts } hideUser />
51
+ { data . posts . length > 0 ? (
52
+ < PostCardList posts = { data . posts } hideUser />
53
+ ) : (
54
+ < EmptyBlock >
55
+ < img src = { undrawBlankCanvas } alt = "list is empty" />
56
+ < div className = "message" > 포스트가 없습니다.</ div >
57
+ </ EmptyBlock >
58
+ ) }
59
+
49
60
{ loading && < PostCardListSkeleton forLoading hideUser = { true } /> }
50
61
< PaginateWithScroll cursor = { cursor } onLoadMore = { onLoadMore } />
51
62
</ >
52
63
) ;
53
64
} ;
54
65
66
+ const EmptyBlock = styled . div `
67
+ width: 100%;
68
+ display: flex;
69
+ align-items: center;
70
+ flex-direction: column;
71
+ margin-top: 6rem;
72
+ margin-bottom: 3rem;
73
+ img {
74
+ width: 20rem;
75
+ }
76
+ .message {
77
+ font-size: 2rem;
78
+ color: ${ palette . gray6 } ;
79
+ margin-top: 3rem;
80
+ margin-bottom: 2rem;
81
+ }
82
+ ` ;
83
+
55
84
export default UserPosts ;
You can’t perform that action at this time.
0 commit comments