|
1 | 1 | import Image from 'next/image'
|
2 | 2 | import Container from '@/components/Container'
|
3 | 3 | import TagItem from '@/components/TagItem'
|
4 |
| -import { useRouter } from 'next/router' |
5 | 4 | import { NotionRenderer, Equation, Code, CollectionRow } from 'react-notion-x'
|
6 | 5 | import BLOG from '@/blog.config'
|
7 | 6 | import formatDate from '@/lib/formatDate'
|
8 |
| -import { fetchCusdisLang } from '@/lib/cusdisLang' |
9 |
| -import dynamic from 'next/dynamic' |
10 |
| -import 'gitalk/dist/gitalk.css' |
11 | 7 | import { useLocale } from '@/lib/locale'
|
12 |
| - |
13 |
| -const GitalkComponent = dynamic( |
14 |
| - () => { |
15 |
| - return import('gitalk/dist/gitalk-component') |
16 |
| - }, |
17 |
| - { ssr: false } |
18 |
| -) |
19 |
| -const UtterancesComponent = dynamic( |
20 |
| - () => { |
21 |
| - return import('@/components/Utterances') |
22 |
| - }, |
23 |
| - { ssr: false } |
24 |
| -) |
25 |
| -const CusdisComponent = dynamic( |
26 |
| - () => { |
27 |
| - return import('react-cusdis').then(m => m.ReactCusdis) |
28 |
| - }, |
29 |
| - { ssr: false } |
30 |
| -) |
| 8 | +import { useRouter } from 'next/router' |
| 9 | +import Comments from '@/components/Comments' |
31 | 10 |
|
32 | 11 | const mapPageUrl = id => {
|
33 | 12 | return 'https://www.notion.so/' + id.replace(/-/g, '')
|
@@ -101,49 +80,24 @@ const Layout = ({
|
101 | 80 | )}
|
102 | 81 | </article>
|
103 | 82 | <div className="flex justify-between font-medium text-gray-500 dark:text-gray-400">
|
104 |
| - <button |
105 |
| - onClick={() => router.push(BLOG.path || '/')} |
106 |
| - className="mt-2 cursor-pointer hover:text-black dark:hover:text-gray-100" |
107 |
| - > |
108 |
| - ← {locale.POST.BACK} |
109 |
| - </button> |
110 |
| - <button |
111 |
| - onClick={() => window.scrollTo({ top: 0, behavior: 'smooth' })} |
112 |
| - className="mt-2 cursor-pointer hover:text-black dark:hover:text-gray-100" |
113 |
| - > |
114 |
| - ↑ {locale.POST.TOP} |
115 |
| - </button> |
| 83 | + <a> |
| 84 | + <button |
| 85 | + onClick={() => router.push(BLOG.path || '/')} |
| 86 | + className="mt-2 cursor-pointer hover:text-black dark:hover:text-gray-100" |
| 87 | + > |
| 88 | + ← {locale.POST.BACK} |
| 89 | + </button> |
| 90 | + </a> |
| 91 | + <a> |
| 92 | + <button |
| 93 | + onClick={() => window.scrollTo({ top: 0, behavior: 'smooth' })} |
| 94 | + className="mt-2 cursor-pointer hover:text-black dark:hover:text-gray-100" |
| 95 | + > |
| 96 | + ↑ {locale.POST.TOP} |
| 97 | + </button> |
| 98 | + </a> |
116 | 99 | </div>
|
117 |
| - {BLOG.comment && BLOG.comment.provider === 'gitalk' && ( |
118 |
| - <GitalkComponent |
119 |
| - options={{ |
120 |
| - id: frontMatter.id, |
121 |
| - title: frontMatter.title, |
122 |
| - clientID: BLOG.comment.gitalkConfig.clientID, |
123 |
| - clientSecret: BLOG.comment.gitalkConfig.clientSecret, |
124 |
| - repo: BLOG.comment.gitalkConfig.repo, |
125 |
| - owner: BLOG.comment.gitalkConfig.owner, |
126 |
| - admin: BLOG.comment.gitalkConfig.admin, |
127 |
| - distractionFreeMode: BLOG.comment.gitalkConfig.distractionFreeMode |
128 |
| - }} |
129 |
| - /> |
130 |
| - )} |
131 |
| - {BLOG.comment && BLOG.comment.provider === 'utterances' && ( |
132 |
| - <UtterancesComponent issueTerm={frontMatter.id} /> |
133 |
| - )} |
134 |
| - {BLOG.comment && BLOG.comment.provider === 'cusdis' && ( |
135 |
| - <CusdisComponent |
136 |
| - attrs={{ |
137 |
| - host: BLOG.comment.cusdisConfig.host, |
138 |
| - appId: BLOG.comment.cusdisConfig.appId, |
139 |
| - pageId: frontMatter.id, |
140 |
| - pageTitle: frontMatter.title, |
141 |
| - pageUrl: BLOG.link + router.asPath, |
142 |
| - theme: BLOG.appearance |
143 |
| - }} |
144 |
| - lang={fetchCusdisLang()} |
145 |
| - /> |
146 |
| - )} |
| 100 | + <Comments frontMatter={frontMatter} /> |
147 | 101 | </Container>
|
148 | 102 | )
|
149 | 103 | }
|
|
0 commit comments