1
- import React from 'react' ;
1
+ import React , { useEffect } from 'react' ;
2
2
import MainPageTemplate from '../../components/main/MainPageTemplate' ;
3
3
import MainResponsive from '../../components/main/MainResponsive' ;
4
4
import ReadingListTab from '../../components/readingList/ReadingListTab' ;
@@ -8,22 +8,36 @@ import useReadingList from './hooks/useReadingList';
8
8
import PostCardGrid , {
9
9
PostCardGridSkeleton ,
10
10
} from '../../components/common/PostCardGrid' ;
11
+ import { undrawEmpty } from '../../static/images' ;
12
+ import palette from '../../lib/styles/palette' ;
13
+ import media from '../../lib/styles/media' ;
14
+ import { Helmet } from 'react-helmet-async' ;
11
15
12
16
export type ReadingListPageProps = { } & RouteComponentProps < {
13
17
type : 'liked' | 'read' ;
14
18
} > ;
15
19
16
- function ReadingListPage ( { match } : ReadingListPageProps ) {
20
+ function ReadingListPage ( { match, history } : ReadingListPageProps ) {
17
21
const { type } = match . params ;
18
22
19
23
const { data, loading, isFinished } = useReadingList ( type ) ;
20
24
21
25
return (
22
26
< MainPageTemplate >
27
+ < Helmet >
28
+ { < meta name = "robots" content = "noindex" /> }
29
+ < title > 읽기 목록 - velog</ title >
30
+ </ Helmet >
23
31
< StyledResponsive >
24
32
< ReadingListTab type = { type } />
25
33
< Wrapper >
26
34
< PostCardGrid posts = { data ?. readingList || [ ] } loading = { ! isFinished } />
35
+ { data && data . readingList . length === 0 && (
36
+ < EmptyWrapper >
37
+ < img src = { undrawEmpty } alt = "list is empty" />
38
+ < div className = "description" > 리스트가 비어있습니다.</ div >
39
+ </ EmptyWrapper >
40
+ ) }
27
41
</ Wrapper >
28
42
</ StyledResponsive >
29
43
</ MainPageTemplate >
@@ -38,4 +52,35 @@ const Wrapper = styled.div`
38
52
margin-top: 2rem;
39
53
` ;
40
54
55
+ const EmptyWrapper = styled . div `
56
+ margin-top: 6rem;
57
+ align-items: center;
58
+ justify-content: center;
59
+ display: flex;
60
+ flex-direction: column;
61
+ img {
62
+ width: 25rem;
63
+ height: auto;
64
+ display: block;
65
+ margin-bottom: 2rem;
66
+ }
67
+
68
+ .description {
69
+ color: ${ palette . gray7 } ;
70
+ font-size: 1.5rem;
71
+ }
72
+
73
+ ${ media . small } {
74
+ margin-top: 3rem;
75
+ img {
76
+ max-width: 300px;
77
+ width: calc(100% - 2rem);
78
+ margin-bottom: 1rem;
79
+ }
80
+ .description {
81
+ font-size: 1.25rem;
82
+ }
83
+ }
84
+ ` ;
85
+
41
86
export default ReadingListPage ;
0 commit comments