-
-
{p.title}
-
-
{p.summary}
+ return
+
+
- ))}
-
-
- {' '}
- {hasMore ? locale.COMMON.MORE : `${locale.COMMON.NO_MORE} 😰`}{' '}
+
+ {postsToShow.map(p => (
+
+
+
+
+
+
+ {p.summary}
+
+
+ ))}
+
+
+
+ {' '}
+ {hasMore ? locale.COMMON.MORE : `${locale.COMMON.NO_MORE} 😰`}{' '}
+
-
- )
}
diff --git a/themes/example/LayoutSlug.js b/themes/example/LayoutSlug.js
index 91b11d80..1f7fd409 100644
--- a/themes/example/LayoutSlug.js
+++ b/themes/example/LayoutSlug.js
@@ -2,9 +2,8 @@ import { getPageTableOfContents } from 'notion-utils'
import LayoutBase from './LayoutBase'
import { ArticleLock } from './components/ArticleLock'
import NotionPage from '@/components/NotionPage'
-import Link from 'next/link'
-import { useGlobal } from '@/lib/global'
-import formatDate from '@/lib/formatDate'
+import { ArticleInfo } from './components/ArticleInfo'
+import Comment from '@/components/Comment'
export const LayoutSlug = props => {
const { post, lock, validPassword } = props
@@ -18,57 +17,20 @@ export const LayoutSlug = props => {
post.toc = getPageTableOfContents(post, post.blockMap)
}
- const { locale } = useGlobal()
- const date = formatDate(post?.date?.start_date || post?.createdTime, locale.LOCALE)
-
return (
-
-
-
{post?.title}
+
- {lock && }
+ {lock && }
- {!lock &&
-
-
-
-
-
- {post.category}
-
-
-
|
+ {!lock &&
- {post?.type[0] !== 'Page' && (<>
-
-
- {date}
-
-
-
|
-
- {locale.COMMON.LAST_EDITED_TIME}: {post.lastEditedTime}
-
-
|
+ {post && <>
+
+
+
+ >}
+ }
- >)}
-
-
-
-
-
-
-
-
-
-
- {post && }
- }
-
-
-
+
)
}
diff --git a/themes/example/LayoutTag.js b/themes/example/LayoutTag.js
index e1a549f4..e9809123 100644
--- a/themes/example/LayoutTag.js
+++ b/themes/example/LayoutTag.js
@@ -5,7 +5,7 @@ import { useState } from 'react'
import LayoutBase from './LayoutBase'
export const LayoutTag = props => {
- const { tag, posts } = props
+ const { posts } = props
const { locale } = useGlobal()
const [page, updatePage] = useState(1)
@@ -24,26 +24,36 @@ export const LayoutTag = props => {
updatePage(page + 1)
}
- return (
-
- Tag - {tag}
- {postsToShow.map(p => (
-
- ))}
-
+ return
+ {postsToShow.map(p => (
+
+
+
+
+
+
+ {p.summary}
+
+
+ ))}
+
- {' '}
- {hasMore ? locale.COMMON.MORE : `${locale.COMMON.NO_MORE} 😰`}{' '}
+ {' '}
+ {hasMore ? locale.COMMON.MORE : `${locale.COMMON.NO_MORE} 😰`}{' '}
-
-
- )
+
+
}
diff --git a/themes/example/LayoutTagIndex.js b/themes/example/LayoutTagIndex.js
index 3fb41c9f..249e1639 100644
--- a/themes/example/LayoutTagIndex.js
+++ b/themes/example/LayoutTagIndex.js
@@ -1,24 +1,21 @@
-import { useGlobal } from '@/lib/global'
import Link from 'next/link'
import LayoutBase from './LayoutBase'
export const LayoutTagIndex = (props) => {
const { tags } = props
- const { locale } = useGlobal()
return
-
-
{locale.COMMON.TAGS}:
-
+ })}
+
+
}
diff --git a/themes/example/components/ArticleInfo.js b/themes/example/components/ArticleInfo.js
new file mode 100644
index 00000000..7e92e254
--- /dev/null
+++ b/themes/example/components/ArticleInfo.js
@@ -0,0 +1,48 @@
+import Link from 'next/link'
+import { useGlobal } from '@/lib/global'
+import formatDate from '@/lib/formatDate'
+
+export const ArticleInfo = (props) => {
+ const { post } = props
+
+ const { locale } = useGlobal()
+ const date = formatDate(post?.date?.start_date || post?.createdTime, locale.LOCALE)
+
+ return
+
+ {post?.type[0] !== 'Page' && <>
+
+
+
+ {post.category}
+
+
+
|
+ >}
+
+ {post?.type[0] !== 'Page' && (<>
+
+
+ {date}
+
+
+
|
+
+ {locale.COMMON.LAST_EDITED_TIME}: {post.lastEditedTime}
+
+
|
+
+ >)}
+
+
+
+
+
+
+
+
+
+}
diff --git a/themes/example/components/BlogList.js b/themes/example/components/BlogList.js
new file mode 100644
index 00000000..057d45ef
--- /dev/null
+++ b/themes/example/components/BlogList.js
@@ -0,0 +1,55 @@
+
+import BLOG from '@/blog.config'
+import { useGlobal } from '@/lib/global'
+import { useRouter } from 'next/router'
+import Link from 'next/link'
+
+export const BlogList = (props) => {
+ const { posts, postCount } = props
+
+ const { locale } = useGlobal()
+ const router = useRouter()
+ const totalPage = Math.ceil(postCount / BLOG.POSTS_PER_PAGE)
+
+ const page = 1
+ const showNext =
+ page < totalPage &&
+ posts.length === BLOG.POSTS_PER_PAGE &&
+ posts.length < postCount
+
+ const currentPage = +page
+
+ return
+
+ {posts.map(p => (
+
+
+
+
+
+
+ {p.summary}
+
+
+ ))}
+
+
+
+}
diff --git a/themes/example/components/Footer.js b/themes/example/components/Footer.js
new file mode 100644
index 00000000..86f0b9cb
--- /dev/null
+++ b/themes/example/components/Footer.js
@@ -0,0 +1,49 @@
+import BLOG from '@/blog.config'
+
+export const Footer = (props) => {
+ const d = new Date()
+ const currentYear = d.getFullYear()
+ const startYear = BLOG.SINCE && BLOG.SINCE !== currentYear && BLOG.SINCE + '-'
+
+ // {/* 页脚 */}
+ //
+
+ return
+}
diff --git a/themes/example/components/Header.js b/themes/example/components/Header.js
new file mode 100644
index 00000000..399fb5b7
--- /dev/null
+++ b/themes/example/components/Header.js
@@ -0,0 +1,21 @@
+import Link from 'next/link'
+
+/**
+ * 网站顶部
+ * @returns
+ */
+export const Header = (props) => {
+ const { siteInfo } = props
+
+ return
+}
diff --git a/themes/example/components/JumpToTopButton.js b/themes/example/components/JumpToTopButton.js
new file mode 100644
index 00000000..30e684a8
--- /dev/null
+++ b/themes/example/components/JumpToTopButton.js
@@ -0,0 +1,19 @@
+import { useGlobal } from '@/lib/global'
+import React from 'react'
+
+/**
+ * 跳转到网页顶部
+ * 当屏幕下滑500像素后会出现该控件
+ * @param targetRef 关联高度的目标html标签
+ * @param showPercent 是否显示百分比
+ * @returns {JSX.Element}
+ * @constructor
+ */
+const JumpToTopButton = () => {
+ const { locale } = useGlobal()
+ return
window.scrollTo({ top: 0, behavior: 'smooth' })}
+ >
+
+}
+
+export default JumpToTopButton
diff --git a/themes/example/components/Nav.js b/themes/example/components/Nav.js
new file mode 100644
index 00000000..4c3217c0
--- /dev/null
+++ b/themes/example/components/Nav.js
@@ -0,0 +1,39 @@
+import { useGlobal } from '@/lib/global'
+import Link from 'next/link'
+
+/**
+ * 菜单导航
+ * @param {*} props
+ * @returns
+ */
+export const Nav = (props) => {
+ const { customNav } = props
+ const { locale } = useGlobal()
+ let links = [
+ { icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search' },
+ { icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive' },
+ { icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category' },
+ { icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag' }
+ ]
+
+ if (customNav) {
+ links = links.concat(customNav)
+ }
+
+ return
+}
diff --git a/themes/example/components/SideBar.js b/themes/example/components/SideBar.js
new file mode 100644
index 00000000..b082bc6d
--- /dev/null
+++ b/themes/example/components/SideBar.js
@@ -0,0 +1,44 @@
+import Live2D from '@/components/Live2D'
+import { useGlobal } from '@/lib/global'
+import Link from 'next/link'
+
+export const SideBar = (props) => {
+ const { locale } = useGlobal()
+ const { latestPosts, categories } = props
+ return
+
+
+
+
+
+
+
+
+}
diff --git a/themes/example/components/Title.js b/themes/example/components/Title.js
new file mode 100644
index 00000000..b0535341
--- /dev/null
+++ b/themes/example/components/Title.js
@@ -0,0 +1,19 @@
+import BLOG from '@/blog.config'
+
+/**
+ * 标题栏
+ * @param {*} props
+ * @returns
+ */
+export const Title = (props) => {
+ const { siteInfo, post } = props
+ const title = post?.title || siteInfo?.description
+ const description = post?.description || BLOG.AUTHOR
+
+ return
+
{title}
+
+ {description}
+
+
+}