diff --git a/components/Drawer.js b/components/Drawer.js index 1375e7d2..3ac656be 100644 --- a/components/Drawer.js +++ b/components/Drawer.js @@ -6,7 +6,7 @@ import React, { useImperativeHandle, useState } from 'react' import InfoCard from '@/components/InfoCard' import TagList from '@/components/TagList' import Logo from '@/components/Logo' -import LastedPosts from '@/components/LastedPosts' +import LatestPosts from '@/components/LatestPosts' /** * 抽屉面板,可以从侧面拉出 @@ -58,7 +58,7 @@ const Drawer = ({ post, currentTag, cRef, tags, posts }) => { {/* 最新文章 */} {posts && (
- +
)} diff --git a/components/LastedPosts.js b/components/LatestPosts.js similarity index 88% rename from components/LastedPosts.js rename to components/LatestPosts.js index 88e1d4c6..603e6bbd 100644 --- a/components/LastedPosts.js +++ b/components/LatestPosts.js @@ -8,7 +8,7 @@ import { useRouter } from 'next/router' * @param posts * @constructor */ -const LastedPosts = ({ posts }) => { +const LatestPosts = ({ posts }) => { // 按时间排序 if (posts) { posts = posts.sort((a, b) => { @@ -28,11 +28,11 @@ const LastedPosts = ({ posts }) => { {posts.map(post => { return ( -
+
{formatDateFmt(post.lastEditedTime, 'yyyy/MM/dd')}
-
+
{post.title}
@@ -42,4 +42,4 @@ const LastedPosts = ({ posts }) => {
} -export default LastedPosts +export default LatestPosts diff --git a/components/SearchInput.js b/components/SearchInput.js index 0a64363c..df0799a3 100644 --- a/components/SearchInput.js +++ b/components/SearchInput.js @@ -17,8 +17,10 @@ const SearchInput = ({ currentTag, currentSearch }) => { } } const handleKeyUp = (e) => { - if (e.keyCode === 13) { + if (e.keyCode === 13) { // 回车 handleSearch(searchInputRef.current.value) + } else if (e.keyCode === 27) { // ESC + cleanSearch() } } const cleanSearch = () => { diff --git a/components/SideBar.js b/components/SideBar.js index 781e8d1a..ab6632ee 100644 --- a/components/SideBar.js +++ b/components/SideBar.js @@ -2,7 +2,7 @@ import React from 'react' import MenuButtonGroup from '@/components/MenuButtonGroup' import InfoCard from '@/components/InfoCard' import TagList from '@/components/TagList' -import LastedPosts from '@/components/LastedPosts' +import LatestPosts from '@/components/LatestPosts' const SideBar = ({ tags, currentTag, post, posts }) => { // 按时间排序 @@ -29,7 +29,7 @@ const SideBar = ({ tags, currentTag, post, posts }) => { {/* 最新文章 */} {posts && (
- +
)} diff --git a/pages/article/[slug].js b/pages/article/[slug].js index 84604100..71eb2e3e 100644 --- a/pages/article/[slug].js +++ b/pages/article/[slug].js @@ -27,7 +27,7 @@ import 'prismjs/components/prism-typescript' const mapPageUrl = id => { return 'https://www.notion.so/' + id.replace(/-/g, '') } -const BlogPost = ({ post, blockMap, tags, prev, next, posts }) => { +const ArticleDetail = ({ post, blockMap, tags, prev, next, posts }) => { if (!post) { return } @@ -39,7 +39,7 @@ const BlogPost = ({ post, blockMap, tags, prev, next, posts }) => { const targetRef = useRef(null) const url = BLOG.link + useRouter().asPath - return + return {/* 阅读进度条 */} @@ -209,4 +209,4 @@ export async function getStaticProps ({ params: { slug } }) { } } -export default BlogPost +export default ArticleDetail