theme 优化

This commit is contained in:
tangly1024.com
2024-01-30 18:05:37 +08:00
parent 51d3cdc9fc
commit b5bfdcba4b
16 changed files with 180 additions and 205 deletions

View File

@@ -47,12 +47,14 @@ export const useMediumGlobal = () => useContext(ThemeGlobalMedium)
* @constructor
*/
const LayoutBase = props => {
const { children, showInfoCard = true, slotRight, slotTop, notice, meta } = props
const { children, showInfoCard = true, slotRight, notice, meta } = props
const { locale } = useGlobal()
const router = useRouter()
const [tocVisible, changeTocVisible] = useState(false)
const { onLoading, fullWidth } = useGlobal()
const slotTop = <BlogPostBar {...props} />
return (
<ThemeGlobalMedium.Provider value={{ tocVisible, changeTocVisible }}>
{/* SEO相关 */}
@@ -137,10 +139,9 @@ const LayoutIndex = (props) => {
* @returns
*/
const LayoutPostList = (props) => {
const slotTop = <BlogPostBar {...props} />
return <div {...props} slotTop={slotTop}>
return <>
{siteConfig('POST_LIST_STYLE') === 'page' ? <BlogPostListPage {...props} /> : <BlogPostListScroll {...props} />}
</div>
</>
}
/**
@@ -220,7 +221,7 @@ const LayoutSearch = (props) => {
}
}, [])
return <div {...props}>
return <>
{/* 搜索导航栏 */}
<div className='py-12'>
@@ -236,7 +237,7 @@ const LayoutSearch = (props) => {
{currentSearch && <div>
{siteConfig('POST_LIST_STYLE') === 'page' ? <BlogPostListPage {...props} /> : <BlogPostListScroll {...props} />}
</div>}
</div>
</>
}
/**
@@ -247,12 +248,12 @@ const LayoutSearch = (props) => {
const LayoutArchive = props => {
const { archivePosts } = props
return (
<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>
</div>
</>
)
}
@@ -262,9 +263,9 @@ const LayoutArchive = props => {
* @returns
*/
const Layout404 = props => {
return <div {...props}>
return <>
<div className='w-full h-96 py-80 flex justify-center items-center'>404 Not found.</div>
</div>
</>
}
/**
@@ -276,7 +277,7 @@ const LayoutCategoryIndex = (props) => {
const { categoryOptions } = props
const { locale } = useGlobal()
return (
<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 +299,7 @@ const LayoutCategoryIndex = (props) => {
})}
</div>
</div>
</div>
</>
)
}
@@ -311,7 +312,7 @@ const LayoutTagIndex = props => {
const { tagOptions } = props
const { locale } = useGlobal()
return (
<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,7 +328,7 @@ const LayoutTagIndex = props => {
})}
</div>
</div>
</div>
</>
)
}