build: 修复编译问题

This commit is contained in:
tangly1024
2022-01-15 22:14:23 +08:00
parent 018af8fe7f
commit cb97fb7b52
11 changed files with 20 additions and 39 deletions

View File

@@ -5,7 +5,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faSpinner } from '@fortawesome/free-solid-svg-icons'
import { useEffect } from 'react'
const Layout404 = () => {
export const Layout404 = () => {
const router = useRouter()
useEffect(() => {
// 延时3秒如果加载失败就返回首页
@@ -33,5 +33,3 @@ const Layout404 = () => {
</div>
</LayoutBase>
}
export default Layout404

View File

@@ -5,7 +5,7 @@ import LayoutBase from './LayoutBase'
import BlogPostArchive from './components/BlogPostArchive'
import Live2D from './components/Live2D'
const LayoutArchive = ({ posts, tags, categories, postCount }) => {
export const LayoutArchive = ({ posts, tags, categories, postCount }) => {
const { locale } = useGlobal()
// 深拷贝
const postsSortByDate = Object.create(posts)
@@ -63,5 +63,3 @@ const LayoutArchive = ({ posts, tags, categories, postCount }) => {
</LayoutBase>
)
}
export default LayoutArchive

View File

@@ -5,7 +5,7 @@ import StickyBar from './components/StickyBar'
import CategoryList from './components/CategoryList'
import BlogPostListScroll from './components/BlogPostListScroll'
const Category = ({ tags, posts, category, categories, latestPosts, postCount }) => {
export const LayoutCategory = ({ tags, posts, category, categories, latestPosts, postCount }) => {
const { locale } = useGlobal()
const meta = {
title: `${category} | ${locale.COMMON.CATEGORY} | ${BLOG.title}`,
@@ -21,5 +21,3 @@ const Category = ({ tags, posts, category, categories, latestPosts, postCount })
</div>
</LayoutBase>
}
export default Category

View File

@@ -5,7 +5,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faFolder, faThList } from '@fortawesome/free-solid-svg-icons'
import Link from 'next/link'
const LayoutCategoryIndex = ({
export const LayoutCategoryIndex = ({
tags,
allPosts,
categories,
@@ -36,5 +36,3 @@ const LayoutCategoryIndex = ({
</div>
</LayoutBase>
}
export default LayoutCategoryIndex

View File

@@ -6,7 +6,7 @@ import BlogPostListScroll from './components/BlogPostListScroll'
import BlogPostListPage from './components/BlogPostListPage'
import { CONFIG_NEXT } from './index'
const LayoutIndex = ({ posts, tags, meta, categories, postCount, latestPosts }) => {
export const LayoutIndex = ({ posts, tags, meta, categories, postCount, latestPosts }) => {
return <LayoutBase
headerSlot={CONFIG_NEXT.HOME_BANNER && <Header />}
meta={meta}
@@ -27,5 +27,3 @@ const LayoutIndex = ({ posts, tags, meta, categories, postCount, latestPosts })
)}
</LayoutBase>
}
export default LayoutIndex

View File

@@ -3,7 +3,7 @@ import LatestPostsGroup from './components/LatestPostsGroup'
import BlogPostListPage from './components/BlogPostListPage'
import { CONFIG_NEXT } from './index'
const LayoutPage = ({ page, posts, tags, meta, categories, postCount, latestPosts }) => {
export const LayoutPage = ({ page, posts, tags, meta, categories, postCount, latestPosts }) => {
return (
<LayoutBase
meta={meta}
@@ -17,5 +17,3 @@ const LayoutPage = ({ page, posts, tags, meta, categories, postCount, latestPost
</LayoutBase>
)
}
export default LayoutPage

View File

@@ -7,7 +7,7 @@ import { useGlobal } from '@/lib/global'
import BLOG from '@/blog.config'
import { useRouter } from 'next/router'
const LayoutSearch = ({ posts, tags, categories, postCount }) => {
export const LayoutSearch = ({ posts, tags, categories, postCount }) => {
let filteredPosts
const searchKey = getSearchKey()
if (searchKey) {
@@ -47,8 +47,6 @@ const LayoutSearch = ({ posts, tags, categories, postCount }) => {
)
}
export default LayoutSearch
function getSearchKey () {
const router = useRouter()
if (router.query && router.query.s) {

View File

@@ -16,7 +16,7 @@ import 'prismjs/components/prism-python'
import 'prismjs/components/prism-typescript'
import { CONFIG_NEXT } from './index'
const LayoutSlug = ({
export const LayoutSlug = ({
post,
tags,
prev,
@@ -74,5 +74,3 @@ const LayoutSlug = ({
</LayoutBase>
)
}
export default LayoutSlug

View File

@@ -5,7 +5,7 @@ import StickyBar from './components/StickyBar'
import TagList from './components/TagList'
import BlogPostListScroll from './components/BlogPostListScroll'
const LayoutTag = ({ tags, posts, tag, categories, postCount, latestPosts }) => {
export const LayoutTag = ({ tags, posts, tag, categories, postCount, latestPosts }) => {
const { locale } = useGlobal()
const meta = {
@@ -28,5 +28,3 @@ const LayoutTag = ({ tags, posts, tag, categories, postCount, latestPosts }) =>
</div>
</LayoutBase>
}
export default LayoutTag

View File

@@ -5,7 +5,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faTags } from '@fortawesome/free-solid-svg-icons'
import TagItem from './components/TagItem'
const LayoutTagIndex = ({ tags, categories, postCount, latestPosts }) => {
export const LayoutTagIndex = ({ tags, categories, postCount, latestPosts }) => {
const { locale } = useGlobal()
const meta = {
title: `${locale.COMMON.TAGS} | ${BLOG.title}`,
@@ -23,4 +23,3 @@ const LayoutTagIndex = ({ tags, categories, postCount, latestPosts }) => {
</div>
</LayoutBase>
}
export default LayoutTagIndex

View File

@@ -1,13 +1,13 @@
export const LayoutIndex = import('./LayoutIndex')
export const LayoutSearch = import('./LayoutSearch')
export const LayoutArchive = import('./LayoutArchive')
export const LayoutSlug = import('./LayoutSlug')
export const Layout404 = import('./Layout404')
export const LayoutCategory = import('./LayoutCategory')
export const LayoutCategoryIndex = import('./LayoutCategoryIndex')
export const LayoutPage = import('./LayoutPage')
export const LayoutTag = import('./LayoutTag')
export const LayoutTagIndex = import('./LayoutTagIndex')
export { LayoutIndex } from './LayoutIndex'
export { LayoutSearch } from './LayoutSearch'
export { LayoutArchive } from './LayoutArchive'
export { LayoutSlug } from './LayoutSlug'
export { Layout404 } from './Layout404'
export { LayoutCategory } from './LayoutCategory'
export { LayoutCategoryIndex } from './LayoutCategoryIndex'
export { LayoutPage } from './LayoutPage'
export { LayoutTag } from './LayoutTag'
export { LayoutTagIndex } from './LayoutTagIndex'
export const CONFIG_NEXT = {
// 首页相关配置