This commit is contained in:
tangly1024
2023-11-06 23:21:09 +08:00
parent 64c216877a
commit df6915362f
2 changed files with 17 additions and 26 deletions

View File

@@ -7,28 +7,29 @@ export default function PostHeader({ post, siteInfo }) {
return <></>
}
const headerImage = post?.pageCover ? post.pageCover : siteInfo?.pageCover
const title = post?.title
console.log('标题', title)
return (
<div id="header" className="w-full h-96 relative md:flex-shrink-0 z-10" >
<LazyImage priority={true} src={headerImage} className='w-full h-full object-cover object-center absolute top-0'/>
<LazyImage priority={true} src={headerImage} className='w-full h-full object-cover object-center absolute top-0' />
<header id='article-header-cover'
className="bg-black bg-opacity-70 absolute top-0 w-full h-96 py-10 flex justify-center items-center ">
className="bg-black bg-opacity-70 absolute top-0 w-full h-96 py-10 flex justify-center items-center ">
<div className='mt-10'>
<div className='mb-3 flex justify-center'>
{post.category && <>
<Link href={`/category/${post.category}`} passHref legacyBehavior>
<div className="cursor-pointer px-2 py-1 mb-2 border rounded-sm dark:border-white text-sm font-medium hover:underline duration-200 shadow-text-md text-white">
{post.category}
</div>
</Link>
</>}
</div>
<div className='mb-3 flex justify-center'>
{post.category && <>
<Link href={`/category/${post.category}`} passHref legacyBehavior>
<div className="cursor-pointer px-2 py-1 mb-2 border rounded-sm dark:border-white text-sm font-medium hover:underline duration-200 shadow-text-md text-white">
{post.category}
</div>
</Link>
</>}
</div>
{/* 文章Title */}
<div className="leading-snug font-bold xs:text-4xl sm:text-4xl md:text-5xl md:leading-snug text-4xl shadow-text-md flex justify-center text-center text-white">
<NotionIcon icon={post.pageIcon} className='text-4xl mx-1' />{post.title}
<NotionIcon icon={post.pageIcon} className='text-4xl mx-1' /><div className='text-4xl mx-1'>{title}</div>
</div>
</div>

View File

@@ -113,7 +113,7 @@ const LayoutIndex = (props) => {
{/* 首页企业/品牌介绍 */}
{notice && <div id='brand-introduction' className='w-full my-4 mx-4'>
<div className='w-full text-center text-4xl font-bold pt-12'>{siteConfig('TEXT_HOME_ABOUT_US', notice.title)}</div>
<NotionPage post={notice} className='text-2xl text-justify'/>
<NotionPage post={notice} className='text-2xl text-justify' />
</div>}
{/* 铺开导航菜单 */}
@@ -201,21 +201,11 @@ const LayoutSlug = props => {
const targetRef = isBrowser ? document.getElementById('article-wrapper') : null
const headerImage = post?.pageCover ? post.pageCover : siteConfig('HOME_BANNER_IMAGE')
// const floatSlot = <>
// {post?.toc?.length > 1 && <div className="block lg:hidden">
// <TocDrawerButton
// onClick={() => {
// drawerRight?.current?.handleSwitchVisible()
// }}
// />
// </div>}
// <JumpToCommentButton />
// </>
const floatSlot = <></>
const headerSlot = <PostHeader {...props} />
return (
<LayoutBase {...props} headerSlot={<PostHeader {...props} />} showCategory={false} showTag={false} floatSlot={floatSlot} >
<LayoutBase {...props} headerSlot={headerSlot} showCategory={false} showTag={false} floatSlot={floatSlot} >
<div className="w-full max-w-screen-xl mx-auto lg:hover:shadow lg:border lg:px-2 lg:py-4 bg-white dark:bg-hexo-black-gray dark:border-black article">
{lock && <ArticleLock validPassword={validPassword} />}