mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
微调
This commit is contained in:
@@ -1,11 +1,36 @@
|
||||
import PropTypes from 'prop-types'
|
||||
import React, { useEffect } from 'react'
|
||||
import CommonHead from '@/components/CommonHead'
|
||||
import TopNav from '@/components/TopNav'
|
||||
|
||||
const Container = ({ children, layout, fullWidth, ...customMeta }) => {
|
||||
const Container = ({ children, layout, fullWidth, tags, meta, ...customMeta }) => {
|
||||
let windowTop = 0
|
||||
// 监听滚动
|
||||
useEffect(() => {
|
||||
function scrollTrigger () {
|
||||
const scrollS = window.scrollY
|
||||
const nav = document.querySelector('#sticky-nav')
|
||||
const tagsBar = document.querySelector('#tags-bar')
|
||||
console.log(windowTop, scrollS)
|
||||
if (scrollS >= windowTop) {
|
||||
nav && nav.classList.add('-mt-16')
|
||||
tagsBar && tagsBar.classList.add('-mt-32')
|
||||
windowTop = scrollS
|
||||
} else {
|
||||
nav && nav.classList.remove('-mt-16')
|
||||
tagsBar && tagsBar.classList.remove('-mt-32')
|
||||
windowTop = scrollS
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('scroll', scrollTrigger)
|
||||
})
|
||||
return (
|
||||
<div>
|
||||
{/* 公共头 */}
|
||||
<>
|
||||
<CommonHead meta={meta} />
|
||||
<TopNav tags={tags}/>
|
||||
{children}
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ const SideBar = ({ tags, currentTag, post }) => {
|
||||
return <aside className='z-10 bg-white dark:border-gray-500 border-gray-200 hidden xl:block'>
|
||||
<div className='dark:bg-gray-800 border-r dark:border-gray-700 h-full scroll-hidden left-0 duration-500 ease-in-out min-h-screen'>
|
||||
<div className='hidden md:block sticky top-16'>
|
||||
<div className={post ? 'hidden xl:block' : 'block'}>
|
||||
<div className={post ? 'hidden 2xl:block' : 'block'}>
|
||||
<MenuButtonGroup allowCollapse={true}/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user