@@ -13,53 +13,58 @@ export default function ArticleRecommend({ recommendPosts, siteInfo }) {
13
13
14
14
if (
15
15
! CONFIG . ARTICLE_RECOMMEND ||
16
- ! recommendPosts ||
17
- recommendPosts . length === 0
16
+ ! recommendPosts ||
17
+ recommendPosts . length === 0
18
18
) {
19
19
return < > </ >
20
20
}
21
21
22
22
return (
23
- < div className = "pt-8" >
24
- < div className = " mb-2 px-1 flex flex-nowrap justify-between" >
25
- < div className = 'dark:text-gray-300' >
26
- < i className = "mr-2 fas fa-thumbs-up" />
27
- { locale . COMMON . RELATE_POSTS }
28
- </ div >
29
- </ div >
30
- < div className = "grid grid-cols-2 md:grid-cols-3 gap-4" >
31
- { recommendPosts . map ( post => {
32
- const headerImage = post ?. pageCoverThumbnail
33
- ? `url("${ post . pageCoverThumbnail } ")`
34
- : `url("${ siteInfo ?. pageCover } ")`
35
-
36
- return (
37
- ( < Link
38
- key = { post . id }
39
- title = { post . title }
40
- href = { `${ BLOG . SUB_PATH } /${ post . slug } ` }
41
- passHref
42
- className = "flex h-40 cursor-pointer overflow-hidden" >
23
+ < div className = "pt-8 hidden md:block" >
43
24
44
- < div
45
- className = "h-full w-full bg-cover bg-center bg-no-repeat hover:scale-110 transform duration-200"
46
- style = { { backgroundImage : headerImage } }
47
- >
48
- < div className = "flex items-center justify-center bg-black bg-opacity-60 hover:bg-opacity-10 w-full h-full duration-300 " >
49
- < div className = " text-sm text-white text-center shadow-text" >
50
- < div >
51
- < i className = "fas fa-calendar-alt mr-1" />
52
- { post . date ?. start_date }
53
- </ div >
54
- < div className = "" > { post . title } </ div >
55
- </ div >
25
+ { /* 推荐文章 */ }
26
+ < div className = " mb-2 px-1 flex flex-nowrap justify-between" >
27
+ < div className = 'dark:text-gray-300' >
28
+ < i className = "mr-2 fas fa-thumbs-up" />
29
+ { locale . COMMON . RELATE_POSTS }
56
30
</ div >
57
- </ div >
31
+ </ div >
32
+
33
+ { /* 文章列表 */ }
34
+
35
+ < div className = "grid grid-cols-2 md:grid-cols-3 gap-4" >
36
+ { recommendPosts . map ( post => {
37
+ const headerImage = post ?. pageCoverThumbnail
38
+ ? `url("${ post . pageCoverThumbnail } ")`
39
+ : `url("${ siteInfo ?. pageCover } ")`
58
40
59
- </ Link > )
60
- )
61
- } ) }
62
- </ div >
63
- </ div >
41
+ return (
42
+ ( < Link
43
+ key = { post . id }
44
+ title = { post . title }
45
+ href = { `${ BLOG . SUB_PATH } /${ post . slug } ` }
46
+ passHref
47
+ className = "flex h-40 cursor-pointer overflow-hidden rounded-2xl" >
48
+
49
+ < div
50
+ className = "h-full w-full bg-cover bg-center bg-no-repeat hover:scale-110 transform duration-200"
51
+ style = { { backgroundImage : headerImage } }
52
+ >
53
+ < div className = "flex items-center justify-center bg-black bg-opacity-60 hover:bg-opacity-10 w-full h-full duration-300 " >
54
+ < div className = " text-sm text-white text-center shadow-text" >
55
+ < div >
56
+ < i className = "fas fa-calendar-alt mr-1" />
57
+ { post . date ?. start_date }
58
+ </ div >
59
+ < div className = "" > { post . title } </ div >
60
+ </ div >
61
+ </ div >
62
+ </ div >
63
+
64
+ </ Link > )
65
+ )
66
+ } ) }
67
+ </ div >
68
+ </ div >
64
69
)
65
70
}
0 commit comments