theme 加载优化

This commit is contained in:
tangly1024.com
2024-01-30 12:50:13 +08:00
parent 7b56f15d4d
commit b415446aa6
12 changed files with 185 additions and 241 deletions

View File

@@ -138,9 +138,9 @@ const LayoutIndex = (props) => {
*/
const LayoutPostList = (props) => {
const slotTop = <BlogPostBar {...props} />
return <LayoutBase {...props} slotTop={slotTop}>
return <div {...props} slotTop={slotTop}>
{siteConfig('POST_LIST_STYLE') === 'page' ? <BlogPostListPage {...props} /> : <BlogPostListScroll {...props} />}
</LayoutBase>
</div>
}
/**
@@ -158,7 +158,7 @@ const LayoutSlug = props => {
)
return (
<LayoutBase showInfoCard={true} slotRight={slotRight} {...props} >
<div showInfoCard={true} slotRight={slotRight} {...props} >
{/* 文章锁 */}
{lock && <ArticleLock validPassword={validPassword} />}
@@ -192,7 +192,7 @@ const LayoutSlug = props => {
{/* 移动端目录 */}
<TocDrawer {...props} />
</div>}
</LayoutBase>
</div>
)
}
@@ -220,7 +220,7 @@ const LayoutSearch = (props) => {
}
}, [])
return <LayoutBase {...props}>
return <div {...props}>
{/* 搜索导航栏 */}
<div className='py-12'>
@@ -236,7 +236,7 @@ const LayoutSearch = (props) => {
{currentSearch && <div>
{siteConfig('POST_LIST_STYLE') === 'page' ? <BlogPostListPage {...props} /> : <BlogPostListScroll {...props} />}
</div>}
</LayoutBase>
</div>
}
/**
@@ -247,12 +247,12 @@ const LayoutSearch = (props) => {
const LayoutArchive = props => {
const { archivePosts } = props
return (
<LayoutBase {...props}>
<div {...props}>
<div className="mb-10 pb-20 md:py-12 py-3 min-h-full">
{Object.keys(archivePosts)?.map(archiveTitle => <BlogArchiveItem key={archiveTitle} archiveTitle={archiveTitle} archivePosts={archivePosts} />
)}
</div>
</LayoutBase>
</div>
)
}
@@ -262,9 +262,9 @@ const LayoutArchive = props => {
* @returns
*/
const Layout404 = props => {
return <LayoutBase {...props}>
return <div {...props}>
<div className='w-full h-96 py-80 flex justify-center items-center'>404 Not found.</div>
</LayoutBase>
</div>
}
/**
@@ -276,7 +276,7 @@ const LayoutCategoryIndex = (props) => {
const { categoryOptions } = props
const { locale } = useGlobal()
return (
<LayoutBase {...props}>
<div {...props}>
<div className='bg-white dark:bg-gray-700 py-10'>
<div className='dark:text-gray-200 mb-5'>
<i className='mr-4 fas fa-th' />{locale.COMMON.CATEGORY}:
@@ -298,7 +298,7 @@ const LayoutCategoryIndex = (props) => {
})}
</div>
</div>
</LayoutBase>
</div>
)
}
@@ -311,7 +311,7 @@ const LayoutTagIndex = props => {
const { tagOptions } = props
const { locale } = useGlobal()
return (
<LayoutBase {...props}>
<div {...props}>
<div className="bg-white dark:bg-gray-700 py-10">
<div className="dark:text-gray-200 mb-5">
<i className="mr-4 fas fa-tag" />
@@ -327,12 +327,13 @@ const LayoutTagIndex = props => {
})}
</div>
</div>
</LayoutBase>
</div>
)
}
export {
CONFIG as THEME_CONFIG,
LayoutBase,
LayoutIndex,
LayoutPostList,
LayoutSearch,