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

View File

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

View File

@@ -5,7 +5,7 @@ import StickyBar from './components/StickyBar'
import CategoryList from './components/CategoryList' import CategoryList from './components/CategoryList'
import BlogPostListScroll from './components/BlogPostListScroll' 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 { locale } = useGlobal()
const meta = { const meta = {
title: `${category} | ${locale.COMMON.CATEGORY} | ${BLOG.title}`, title: `${category} | ${locale.COMMON.CATEGORY} | ${BLOG.title}`,
@@ -21,5 +21,3 @@ const Category = ({ tags, posts, category, categories, latestPosts, postCount })
</div> </div>
</LayoutBase> </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 { faFolder, faThList } from '@fortawesome/free-solid-svg-icons'
import Link from 'next/link' import Link from 'next/link'
const LayoutCategoryIndex = ({ export const LayoutCategoryIndex = ({
tags, tags,
allPosts, allPosts,
categories, categories,
@@ -36,5 +36,3 @@ const LayoutCategoryIndex = ({
</div> </div>
</LayoutBase> </LayoutBase>
} }
export default LayoutCategoryIndex

View File

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

View File

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

View File

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

View File

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

View File

@@ -5,7 +5,7 @@ import StickyBar from './components/StickyBar'
import TagList from './components/TagList' import TagList from './components/TagList'
import BlogPostListScroll from './components/BlogPostListScroll' 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 { locale } = useGlobal()
const meta = { const meta = {
@@ -28,5 +28,3 @@ const LayoutTag = ({ tags, posts, tag, categories, postCount, latestPosts }) =>
</div> </div>
</LayoutBase> </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 { faTags } from '@fortawesome/free-solid-svg-icons'
import TagItem from './components/TagItem' import TagItem from './components/TagItem'
const LayoutTagIndex = ({ tags, categories, postCount, latestPosts }) => { export const LayoutTagIndex = ({ tags, categories, postCount, latestPosts }) => {
const { locale } = useGlobal() const { locale } = useGlobal()
const meta = { const meta = {
title: `${locale.COMMON.TAGS} | ${BLOG.title}`, title: `${locale.COMMON.TAGS} | ${BLOG.title}`,
@@ -23,4 +23,3 @@ const LayoutTagIndex = ({ tags, categories, postCount, latestPosts }) => {
</div> </div>
</LayoutBase> </LayoutBase>
} }
export default LayoutTagIndex

View File

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