Merge pull request #1465 from tangly1024/feat/wwads

Feat/wwads
This commit is contained in:
tangly1024
2023-08-18 16:03:41 +08:00
committed by GitHub
11 changed files with 84 additions and 12 deletions

View File

@@ -62,7 +62,7 @@ const Catalog = ({ post }) => {
}
return <>
<div id='toc-wrapper' className='toc-wrapper overflow-y-auto max-h-96 overscroll-none scroll-hidden'>
<div id='toc-wrapper' className='toc-wrapper overflow-y-auto my-2 max-h-80 overscroll-none scroll-hidden'>
<nav className='h-full text-black'>
{toc.map((tocItem) => {
const id = uuidToId(tocItem.id)

View File

@@ -32,7 +32,7 @@ export const MenuBarMobile = (props) => {
return (
<nav id='nav' className=' text-md'>
{/* {links.map(link => <NormalMenu key={link?.id} link={link}/>)} */}
{links?.map(link => <MenuItemCollapse onHeightChange={props.onHeightChange} key={link?.id} link={link}/>)}
{links?.map((link, index) => <MenuItemCollapse onHeightChange={props.onHeightChange} key={index} link={link}/>)}
</nav>
)

View File

@@ -47,8 +47,8 @@ export const MenuItemCollapse = (props) => {
{/* 折叠子菜单 */}
{hasSubMenu && <Collapse isOpen={isOpen} onHeightChange={props.onHeightChange}>
{link?.subMenus?.map(sLink => {
return <div key={sLink.id} className='
{link?.subMenus?.map((sLink, index) => {
return <div key={index} className='
not:last-child:border-b-0 border-b dark:border-gray-800 py-2 px-14 cursor-pointer hover:bg-gray-100 dark:text-gray-200
font-extralight dark:bg-black text-left justify-start text-gray-600 bg-gray-50 dark:hover:bg-gray-900 tracking-widest transition-all duration-200'>
<Link href={sLink.to} target={link?.to?.indexOf('http') === 0 ? '_blank' : '_self'}>

View File

@@ -64,7 +64,7 @@ export default function TopNavBar(props) {
{/* 桌面端顶部菜单 */}
<div className='hidden md:flex'>
{links && links?.map(link => <MenuItemDrop key={link?.id} link={link} />)}
{links && links?.map((link, index) => <MenuItemDrop key={index} link={link} />)}
<DarkModeButton className='text-sm flex items-center h-full' />
</div>
</div>

View File

@@ -34,6 +34,8 @@ import CommonHead from '@/components/CommonHead'
import BlogArchiveItem from './components/BlogArchiveItem'
import BlogPostListPage from './components/BlogPostListPage'
import Link from 'next/link'
import dynamic from 'next/dynamic'
const WWAds = dynamic(() => import('@/components/WWAds'), { ssr: false })
// 主题全局变量
const ThemeGlobalGitbook = createContext()
@@ -92,6 +94,7 @@ const LayoutBase = (props) => {
<div id='container-inner' className='w-full px-7 max-w-3xl justify-center mx-auto'>
{slotTop}
<AdSlot type='in-article' />
<WWAds className='w-full' orientation='horizontal'/>
<Transition
show={!onLoading}
@@ -107,7 +110,10 @@ const LayoutBase = (props) => {
{children}
</Transition>
{/* Google广告 */}
<AdSlot type='in-article' />
<WWAds className='w-full' orientation='horizontal'/>
{/* 回顶按钮 */}
<JumpToTopButton />
</div>
@@ -126,8 +132,9 @@ const LayoutBase = (props) => {
<div className='py-14 px-6 sticky top-0'>
<ArticleInfo post={props?.post ? props?.post : props.notice} />
<div className='py-6'>
<div className='py-4'>
<Catalog {...props} />
<WWAds/>
{slotRight}
{router.route === '/' && <>
<InfoCard {...props} />
@@ -236,6 +243,7 @@ const LayoutSlug = (props) => {
{post?.type === 'Post' && <ArticleAround prev={prev} next={next} />}
<AdSlot />
<WWAds className='w-full' orientation='horizontal'/>
<Comment frontMatter={post} />
</section>)}