mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-24 23:16:52 +00:00
starter主题logo修复
This commit is contained in:
@@ -33,7 +33,7 @@ export const Header = props => {
|
||||
return () => {
|
||||
window.removeEventListener('scroll', navBarScollListener)
|
||||
}
|
||||
}, [[isDarkMode]])
|
||||
}, [isDarkMode])
|
||||
|
||||
// 滚动监听
|
||||
const throttleMs = 200
|
||||
@@ -58,7 +58,7 @@ export const Header = props => {
|
||||
<div className='container'>
|
||||
<div className='relative -mx-4 flex items-center justify-between'>
|
||||
{/* Logo */}
|
||||
<Logo />
|
||||
<Logo {...props} />
|
||||
|
||||
<div className='flex w-full items-center justify-between px-4'>
|
||||
{/* 中间菜单 */}
|
||||
|
||||
@@ -10,10 +10,12 @@ import { useEffect, useState } from 'react'
|
||||
* 站点图标
|
||||
* @returns
|
||||
*/
|
||||
export const Logo = ({ white }) => {
|
||||
export const Logo = props => {
|
||||
const { white, NOTION_CONFIG } = props
|
||||
const router = useRouter()
|
||||
const { isDarkMode } = useGlobal()
|
||||
const logoWhite = siteConfig('STARTER_LOGO_WHITE')
|
||||
const logoNormal = siteConfig('STARTER_LOGO')
|
||||
const { isDarkMode } = useGlobal()
|
||||
const [logo, setLogo] = useState(logoWhite)
|
||||
const [logoTextColor, setLogoTextColor] = useState('text-white')
|
||||
|
||||
@@ -24,11 +26,12 @@ export const Logo = ({ white }) => {
|
||||
const scrollY = window.scrollY
|
||||
// 何时显示浅色或白底的logo
|
||||
const homePageNavBar = router.route === '/' && scrollY < 10 // 在首页并且视窗在页面顶部
|
||||
|
||||
if (white || isDarkMode || homePageNavBar) {
|
||||
setLogo(siteConfig('STARTER_LOGO_WHITE'))
|
||||
setLogo(logoWhite)
|
||||
setLogoTextColor('text-white')
|
||||
} else {
|
||||
setLogo(siteConfig('STARTER_LOGO'))
|
||||
setLogo(logoNormal)
|
||||
setLogoTextColor('text-black')
|
||||
}
|
||||
}, throttleMs)
|
||||
@@ -50,8 +53,9 @@ export const Logo = ({ white }) => {
|
||||
router.push('/')
|
||||
}}
|
||||
src={logo}
|
||||
height={14}
|
||||
alt='logo'
|
||||
className='header-logo w-full'
|
||||
className='header-logo w-full mr-1'
|
||||
/>
|
||||
)}
|
||||
{/* logo文字 */}
|
||||
|
||||
Reference in New Issue
Block a user