1
- import BlogAround from './BlogAround'
2
1
import Comment from '@/components/Comment'
3
- import RecommendPosts from './RecommendPosts'
2
+ import LazyImage from '@/components/LazyImage'
3
+ import NotionIcon from '@/components/NotionIcon'
4
+ import NotionPage from '@/components/NotionPage'
4
5
import ShareBar from '@/components/ShareBar'
5
- import TagItem from './TagItem'
6
+ import WWAds from '@/components/WWAds'
7
+ import { siteConfig } from '@/lib/config'
6
8
import { useGlobal } from '@/lib/global'
9
+ import { formatDateFmt } from '@/lib/utils/formatDate'
7
10
import Link from 'next/link'
8
11
import { useRouter } from 'next/router'
12
+ import CONFIG from '../config'
9
13
import ArticleCopyright from './ArticleCopyright'
14
+ import BlogAround from './BlogAround'
15
+ import RecommendPosts from './RecommendPosts'
16
+ import TagItem from './TagItem'
10
17
import WordCount from './WordCount'
11
- import NotionPage from '@/components/NotionPage'
12
- import CONFIG from '../config'
13
- import NotionIcon from '@/components/NotionIcon'
14
- import LazyImage from '@/components/LazyImage'
15
- import { formatDateFmt } from '@/lib/utils/formatDate'
16
- import { siteConfig } from '@/lib/config'
17
- import WWAds from '@/components/WWAds'
18
18
19
19
/**
20
20
*
@@ -35,105 +35,135 @@ export default function ArticleDetail(props) {
35
35
}
36
36
37
37
return (
38
- < div id = "article-wrapper"
39
- className = "shadow md:hover:shadow-2xl overflow-x-auto flex-grow mx-auto w-screen md:w-full " >
40
- < div itemScope itemType = "https://schema.org/Movie"
41
- className = "subpixel-antialiased overflow-y-hidden py-10 px-5 lg:pt-24 md:px-24 dark:border-gray-700 bg-white dark:bg-hexo-black-gray article-padding"
42
- >
43
-
44
- { showArticleInfo && < header { ...aosProps } >
45
- { /* 头图 */ }
46
- { siteConfig ( 'NEXT_POST_HEADER_IMAGE_VISIBLE' , null , CONFIG ) && post ?. type && ! post ?. type !== 'Page' && post ?. pageCover && (
47
- < div className = "w-full relative md:flex-shrink-0 overflow-hidden" >
48
- < LazyImage alt = { post . title } src = { post ?. pageCover } className = 'object-center w-full' />
49
- </ div >
50
- ) }
51
-
52
- { /* title */ }
53
- < div className = " text-center font-bold text-3xl text-black dark:text-white font-serif pt-6" >
54
- { siteConfig ( 'POST_TITLE_ICON' ) && < NotionIcon icon = { post . pageIcon } /> } { post . title }
55
- </ div >
56
-
57
- { /* meta */ }
58
- < section className = "mt-2 text-gray-500 dark:text-gray-400 font-light leading-7 text-sm" >
59
- < div className = 'flex flex-wrap justify-center' >
60
- { post ?. type !== 'Page' && ( < >
61
- < Link
62
- href = { `/archive#${ formatDateFmt ( post ?. publishDate , 'yyyy-MM' ) } ` }
63
- passHref
64
- legacyBehavior >
65
- < div className = "pl-1 mr-2 cursor-pointer hover:text-gray-700 dark:hover:text-gray-200 border-b dark:border-gray-500 border-dashed" >
66
- < i className = 'far fa-calendar mr-1' /> { post ?. publishDay }
67
- </ div >
68
- </ Link >
69
- < span className = 'mr-2' > | < i className = 'far fa-calendar-check mr-2' /> { post . lastEditedDay } </ span >
70
-
71
- < div className = "hidden busuanzi_container_page_pv font-light mr-2" >
72
- < i className = 'mr-1 fas fa-eye' />
73
- < span className = "mr-2 busuanzi_value_page_pv" />
74
- </ div >
75
-
76
- </ > ) }
77
- </ div >
78
-
79
- < WordCount />
80
- </ section >
81
-
82
- </ header > }
83
-
84
- { /* Notion内容主体 */ }
85
- < article className = 'mx-auto' >
86
- < WWAds className = "w-full" orientation = "horizontal" />
87
- { post && ( < NotionPage post = { post } /> ) }
88
- < WWAds className = "w-full" orientation = "horizontal" />
89
- </ article >
90
-
91
- { showArticleInfo && < >
92
-
93
- { /* 分享 */ }
94
- < ShareBar post = { post } />
95
-
96
- { /* 版权声明 */ }
97
- { post ?. type === 'Post' && < ArticleCopyright author = { siteConfig ( 'AUTHOR' ) } url = { url } /> }
98
-
99
- { /* 推荐文章 */ }
100
- { post ?. type === 'Post' && < RecommendPosts currentPost = { post } recommendPosts = { recommendPosts } /> }
101
-
102
- < section className = "flex justify-between" >
103
- { /* 分类 */ }
104
- { post . category && < >
105
- < div className = "cursor-pointer my-auto text-md mr-2 hover:text-black dark:hover:text-white border-b dark:text-gray-500 border-dashed" >
106
- < Link href = { `/category/${ post . category } ` } legacyBehavior >
107
- < a > < i className = "mr-1 far fa-folder-open" /> { post . category } </ a >
108
- </ Link >
109
- </ div >
110
- </ > }
111
-
112
- { /* 标签列表 */ }
113
- { post ?. type === 'Post' && (
114
- < >
115
- { post . tagItems && (
116
- < div className = "flex items-center flex-nowrap leading-8 p-1 py-4 overflow-x-auto" >
117
- < div className = "hidden md:block dark:text-gray-300 whitespace-nowrap" >
118
- { locale . COMMON . TAGS } :
119
- </ div >
120
- { post . tagItems . map ( tag => (
121
- < TagItem key = { tag . name } tag = { tag } />
122
- ) ) }
123
- </ div >
124
- ) }
125
- </ >
126
- ) }
127
- </ section >
128
- { post ?. type === 'Post' && < BlogAround prev = { prev } next = { next } /> }
129
- </ > }
130
-
131
- { /* 评论互动 */ }
132
- < div className = "duration-200 w-full dark:border-gray-700 bg-white dark:bg-hexo-black-gray" >
133
- < Comment frontMatter = { post } />
38
+ < div
39
+ id = 'article-wrapper'
40
+ className = 'shadow md:hover:shadow-2xl overflow-x-auto flex-grow mx-auto w-screen md:w-full ' >
41
+ < div
42
+ itemScope
43
+ itemType = 'https://schema.org/Movie'
44
+ className = 'overflow-y-hidden py-10 px-4 lg:pt-24 md:px-24 dark:border-gray-700 bg-white dark:bg-hexo-black-gray' >
45
+ { showArticleInfo && (
46
+ < header { ...aosProps } >
47
+ { /* 头图 */ }
48
+ { siteConfig ( 'NEXT_POST_HEADER_IMAGE_VISIBLE' , null , CONFIG ) &&
49
+ post ?. type &&
50
+ ! post ?. type !== 'Page' &&
51
+ post ?. pageCover && (
52
+ < div className = 'w-full relative md:flex-shrink-0 overflow-hidden' >
53
+ < LazyImage
54
+ alt = { post . title }
55
+ src = { post ?. pageCover }
56
+ className = 'object-center w-full'
57
+ />
134
58
</ div >
59
+ ) }
60
+
61
+ { /* title */ }
62
+ < div className = ' text-center font-bold text-3xl text-black dark:text-white font-serif pt-6' >
63
+ { siteConfig ( 'POST_TITLE_ICON' ) && (
64
+ < NotionIcon icon = { post . pageIcon } />
65
+ ) }
66
+ { post . title }
135
67
</ div >
136
68
69
+ { /* meta */ }
70
+ < section className = 'mt-2 text-gray-500 dark:text-gray-400 font-light leading-7 text-sm' >
71
+ < div className = 'flex flex-wrap justify-center' >
72
+ { post ?. type !== 'Page' && (
73
+ < >
74
+ < Link
75
+ href = { `/archive#${ formatDateFmt ( post ?. publishDate , 'yyyy-MM' ) } ` }
76
+ passHref
77
+ legacyBehavior >
78
+ < div className = 'pl-1 mr-2 cursor-pointer hover:text-gray-700 dark:hover:text-gray-200 border-b dark:border-gray-500 border-dashed' >
79
+ < i className = 'far fa-calendar mr-1' /> { ' ' }
80
+ { post ?. publishDay }
81
+ </ div >
82
+ </ Link >
83
+ < span className = 'mr-2' >
84
+ { ' ' }
85
+ | < i className = 'far fa-calendar-check mr-2' />
86
+ { post . lastEditedDay } { ' ' }
87
+ </ span >
88
+
89
+ < div className = 'hidden busuanzi_container_page_pv font-light mr-2' >
90
+ < i className = 'mr-1 fas fa-eye' />
91
+ < span className = 'mr-2 busuanzi_value_page_pv' />
92
+ </ div >
93
+ </ >
94
+ ) }
95
+ </ div >
96
+
97
+ < WordCount />
98
+ </ section >
99
+ </ header >
100
+ ) }
101
+
102
+ { /* Notion内容主体 */ }
103
+ < article className = 'mx-auto' >
104
+ < WWAds className = 'w-full' orientation = 'horizontal' />
105
+ { post && < NotionPage post = { post } /> }
106
+ < WWAds className = 'w-full' orientation = 'horizontal' />
107
+ </ article >
108
+
109
+ { showArticleInfo && (
110
+ < >
111
+ { /* 分享 */ }
112
+ < ShareBar post = { post } />
113
+
114
+ { /* 版权声明 */ }
115
+ { post ?. type === 'Post' && (
116
+ < ArticleCopyright author = { siteConfig ( 'AUTHOR' ) } url = { url } />
117
+ ) }
118
+
119
+ { /* 推荐文章 */ }
120
+ { post ?. type === 'Post' && (
121
+ < RecommendPosts
122
+ currentPost = { post }
123
+ recommendPosts = { recommendPosts }
124
+ />
125
+ ) }
126
+
127
+ < section className = 'flex justify-between' >
128
+ { /* 分类 */ }
129
+ { post . category && (
130
+ < >
131
+ < div className = 'cursor-pointer my-auto text-md mr-2 hover:text-black dark:hover:text-white border-b dark:text-gray-500 border-dashed' >
132
+ < Link href = { `/category/${ post . category } ` } legacyBehavior >
133
+ < a >
134
+ < i className = 'mr-1 far fa-folder-open' /> { ' ' }
135
+ { post . category }
136
+ </ a >
137
+ </ Link >
138
+ </ div >
139
+ </ >
140
+ ) }
141
+
142
+ { /* 标签列表 */ }
143
+ { post ?. type === 'Post' && (
144
+ < >
145
+ { post . tagItems && (
146
+ < div className = 'flex items-center flex-nowrap leading-8 p-1 py-4 overflow-x-auto' >
147
+ < div className = 'hidden md:block dark:text-gray-300 whitespace-nowrap' >
148
+ { locale . COMMON . TAGS } :
149
+ </ div >
150
+ { post . tagItems . map ( tag => (
151
+ < TagItem key = { tag . name } tag = { tag } />
152
+ ) ) }
153
+ </ div >
154
+ ) }
155
+ </ >
156
+ ) }
157
+ </ section >
158
+ { post ?. type === 'Post' && < BlogAround prev = { prev } next = { next } /> }
159
+ </ >
160
+ ) }
161
+
162
+ { /* 评论互动 */ }
163
+ < div className = 'duration-200 w-full dark:border-gray-700 bg-white dark:bg-hexo-black-gray' >
164
+ < Comment frontMatter = { post } />
137
165
</ div >
166
+ </ div >
167
+ </ div >
138
168
)
139
169
}
0 commit comments