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

@@ -133,9 +133,9 @@ const LayoutPostList = props => {
slotTop = props.slotTop
}
return (
<LayoutBase {...props} slotTop={slotTop}>
<div {...props} slotTop={slotTop}>
{siteConfig('POST_LIST_STYLE') === 'page' ? <BlogListPage {...props} /> : <BlogListScroll {...props} />}
</LayoutBase>
</div>
)
}
@@ -147,7 +147,7 @@ const LayoutPostList = props => {
const LayoutSlug = props => {
const { post, lock, validPassword } = props
return (
<LayoutBase {...props}>
<div {...props}>
{lock
? <ArticleLock validPassword={validPassword} />
: <div id="article-wrapper" className="px-2">
@@ -156,7 +156,7 @@ const LayoutSlug = props => {
<ShareBar post={post} />
<Comment frontMatter={post} />
</div>}
</LayoutBase>
</div>
)
}
@@ -166,7 +166,7 @@ const LayoutSlug = props => {
* @returns
*/
const Layout404 = (props) => {
return <LayoutBase {...props}>404 Not found.</LayoutBase>
return <div {...props}>404 Not found.</div>
}
/**
@@ -207,13 +207,13 @@ const LayoutSearch = props => {
const LayoutArchive = props => {
const { archivePosts } = props
return (
<LayoutBase {...props}>
<div {...props}>
<div className="mb-10 pb-20 md:py-12 p-3 min-h-screen w-full">
{Object.keys(archivePosts).map(archiveTitle => (
<BlogListGroupByDate key={archiveTitle} archiveTitle={archiveTitle} archivePosts={archivePosts} />
))}
</div>
</LayoutBase>
</div>
)
}
@@ -225,11 +225,11 @@ const LayoutArchive = props => {
const LayoutCategoryIndex = props => {
const { categoryOptions } = props
return (
<LayoutBase {...props}>
<div {...props}>
<div id='category-list' className='duration-200 flex flex-wrap'>
{categoryOptions?.map(category => <CategoryItem key={category.name} category={category} />)}
</div>
</LayoutBase>
</div>
)
}
@@ -241,16 +241,17 @@ const LayoutCategoryIndex = props => {
const LayoutTagIndex = (props) => {
const { tagOptions } = props
return (
<LayoutBase {...props}>
<div {...props}>
<div id='tags-list' className='duration-200 flex flex-wrap'>
{tagOptions.map(tag => <TagItem key={tag.name} tag={tag} />)}
</div>
</LayoutBase>
</div>
)
}
export {
CONFIG as THEME_CONFIG,
LayoutBase,
LayoutIndex,
LayoutPostList,
LayoutSearch,