mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
eslint
This commit is contained in:
@@ -49,9 +49,9 @@ const LayoutBase = props => {
|
||||
slotTop = <div className='pb-12'>#{tag}</div>
|
||||
} else if (props.slotTop) {
|
||||
slotTop = props.slotTop
|
||||
} else if (router.route==='/search'){
|
||||
// 嵌入一个搜索框在顶部
|
||||
slotTop = <div className='pb-12'><SearchInput {...props} /></div>
|
||||
} else if (router.route === '/search') {
|
||||
// 嵌入一个搜索框在顶部
|
||||
slotTop = <div className='pb-12'><SearchInput {...props} /></div>
|
||||
}
|
||||
|
||||
// 增加一个状态以触发 Transition 组件的动画
|
||||
@@ -136,7 +136,6 @@ const LayoutIndex = props => {
|
||||
* @returns
|
||||
*/
|
||||
const LayoutPostList = props => {
|
||||
|
||||
return (
|
||||
<>
|
||||
{siteConfig('POST_LIST_STYLE') === 'page' ? <BlogListPage {...props} /> : <BlogListScroll {...props} />}
|
||||
|
||||
@@ -31,7 +31,6 @@ import { Transition } from '@headlessui/react'
|
||||
import { Style } from './style'
|
||||
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'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
@@ -59,7 +59,7 @@ const LayoutBase = props => {
|
||||
const { fullWidth } = useGlobal()
|
||||
const router = useRouter()
|
||||
console.log(router)
|
||||
|
||||
|
||||
const headerSlot = (
|
||||
<header>
|
||||
{/* 顶部导航 */}
|
||||
@@ -67,11 +67,12 @@ const LayoutBase = props => {
|
||||
<NavBar {...props} />
|
||||
</div>
|
||||
{/* 通知横幅 */}
|
||||
{router.route==='/' ? <>
|
||||
{router.route === '/'
|
||||
? <>
|
||||
<NoticeBar />
|
||||
<Hero {...props} />
|
||||
</>
|
||||
: null}
|
||||
: null}
|
||||
<div className="max-w-[86rem] mx-auto px-3">
|
||||
<WWAds className="w-full" orientation="horizontal" />
|
||||
</div>
|
||||
@@ -159,7 +160,6 @@ const LayoutIndex = props => {
|
||||
* @returns
|
||||
*/
|
||||
const LayoutPostList = props => {
|
||||
|
||||
return (
|
||||
<div id="post-outer-wrapper" className="px-5 md:px-0">
|
||||
{/* 文章分类条 */}
|
||||
@@ -184,7 +184,7 @@ const LayoutSearch = props => {
|
||||
const { keyword } = props
|
||||
const router = useRouter()
|
||||
const currentSearch = keyword || router?.query?.s
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
// 高亮搜索结果
|
||||
if (currentSearch) {
|
||||
@@ -270,7 +270,6 @@ const LayoutSlug = props => {
|
||||
setHasCode(hasCode)
|
||||
}, [])
|
||||
|
||||
|
||||
const commentEnable = siteConfig('COMMENT_TWIKOO_ENV_ID') || siteConfig('COMMENT_WALINE_SERVER_URL') || siteConfig('COMMENT_VALINE_APP_ID') ||
|
||||
siteConfig('COMMENT_GISCUS_REPO') || siteConfig('COMMENT_CUSDIS_APP_ID') || siteConfig('COMMENT_UTTERRANCES_REPO') ||
|
||||
siteConfig('COMMENT_GITALK_CLIENT_ID') || siteConfig('COMMENT_WEBMENTION_ENABLE')
|
||||
@@ -428,7 +427,6 @@ const LayoutCategoryIndex = props => {
|
||||
const { categoryOptions } = props
|
||||
const { locale } = useGlobal()
|
||||
|
||||
|
||||
return (
|
||||
<div id="category-outer-wrapper" className="mt-8 px-5 md:px-0">
|
||||
<div className="text-4xl font-extrabold dark:text-gray-200 mb-5">
|
||||
|
||||
@@ -21,7 +21,7 @@ const TocDrawer = ({ post, cRef }) => {
|
||||
}
|
||||
return <>
|
||||
<div className='fixed top-0 right-0 z-40 '>
|
||||
{/* 侧边菜单 */}
|
||||
{/* 悬浮目录 */}
|
||||
<div
|
||||
className={(showDrawer ? 'animate__slideInRight ' : ' -mr-72 animate__slideOutRight') +
|
||||
' shadow-card animate__animated animate__faster' +
|
||||
|
||||
@@ -34,7 +34,6 @@ import replaceSearchResult from '@/components/Mark'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import AlgoliaSearchModal from '@/components/AlgoliaSearchModal'
|
||||
|
||||
|
||||
// 主题全局状态
|
||||
const ThemeGlobalHexo = createContext()
|
||||
export const useHexoGlobal = () => useContext(ThemeGlobalHexo)
|
||||
@@ -46,14 +45,19 @@ export const useHexoGlobal = () => useContext(ThemeGlobalHexo)
|
||||
* @constructor
|
||||
*/
|
||||
const LayoutBase = props => {
|
||||
const { post , children, slotTop, meta, className } = props
|
||||
const { post, children, slotTop, meta, className } = props
|
||||
const { onLoading, fullWidth } = useGlobal()
|
||||
|
||||
const router = useRouter()
|
||||
const headerSlot = post
|
||||
? <PostHeader {...props} /> : (router.route==='/' && siteConfig('HEXO_HOME_BANNER_ENABLE', null, CONFIG)
|
||||
? <Hero {...props} /> : null)
|
||||
|
||||
? <PostHeader {...props} />
|
||||
: (router.route === '/' && siteConfig('HEXO_HOME_BANNER_ENABLE', null, CONFIG)
|
||||
? <Hero {...props} />
|
||||
: null)
|
||||
|
||||
const drawerRight = useRef(null)
|
||||
const tocRef = isBrowser ? document.getElementById('article-wrapper') : null
|
||||
|
||||
const floatSlot = <>
|
||||
{post?.toc?.length > 1 && <div className="block lg:hidden">
|
||||
<TocDrawerButton
|
||||
@@ -121,6 +125,10 @@ const LayoutBase = props => {
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<div className='block lg:hidden'>
|
||||
<TocDrawer post={post} cRef={drawerRight} targetRef={tocRef} />
|
||||
</div>
|
||||
|
||||
{/* 悬浮菜单 */}
|
||||
<RightFloatArea floatSlot={floatSlot} />
|
||||
|
||||
@@ -141,7 +149,7 @@ const LayoutBase = props => {
|
||||
* @returns
|
||||
*/
|
||||
const LayoutIndex = (props) => {
|
||||
return <LayoutPostList {...props} className='pt-8' />
|
||||
return <LayoutPostList {...props} className='pt-8' />
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -217,8 +225,6 @@ const LayoutArchive = (props) => {
|
||||
*/
|
||||
const LayoutSlug = props => {
|
||||
const { post, lock, validPassword } = props
|
||||
const drawerRight = useRef(null)
|
||||
const tocRef = isBrowser ? document.getElementById('article-wrapper') : null
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -252,10 +258,6 @@ const LayoutSlug = props => {
|
||||
</div>}
|
||||
</div>
|
||||
|
||||
<div className='block lg:hidden'>
|
||||
<TocDrawer post={post} cRef={drawerRight} targetRef={tocRef} />
|
||||
</div>
|
||||
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -43,9 +43,10 @@ const LayoutBase = props => {
|
||||
const { children, meta, siteInfo, post } = props
|
||||
const { onLoading, fullWidth } = useGlobal()
|
||||
const router = useRouter()
|
||||
const containerSlot= router.route==='/' ? <Announcement {...props} /> : <BlogListBar {...props} />
|
||||
const headerSlot= siteConfig('MATERY_HOME_BANNER_ENABLE', null, CONFIG) && router.route==='/'
|
||||
? <Hero {...props} /> : (post && !fullWidth ? <PostHeader {...props} /> : null)
|
||||
const containerSlot = router.route === '/' ? <Announcement {...props} /> : <BlogListBar {...props} />
|
||||
const headerSlot = siteConfig('MATERY_HOME_BANNER_ENABLE', null, CONFIG) && router.route === '/'
|
||||
? <Hero {...props} />
|
||||
: (post && !fullWidth ? <PostHeader {...props} /> : null)
|
||||
|
||||
const floatRightBottom = post ? <JumpToCommentButton /> : null
|
||||
|
||||
@@ -198,7 +199,7 @@ const LayoutArchive = (props) => {
|
||||
const LayoutSlug = props => {
|
||||
const { post, lock, validPassword } = props
|
||||
const { fullWidth } = useGlobal()
|
||||
|
||||
|
||||
return (<>
|
||||
|
||||
<div id='inner-wrapper' className={`w-full ${fullWidth ? '' : 'lg:max-w-3xl 2xl:max-w-4xl'}`} >
|
||||
|
||||
@@ -25,7 +25,6 @@ import { ArticleLock } from './components/ArticleLock'
|
||||
import { Transition } from '@headlessui/react'
|
||||
import { Style } from './style'
|
||||
import CommonHead from '@/components/CommonHead'
|
||||
import BlogArchiveItem from './components/BlogArchiveItem'
|
||||
import BlogPostListAll from './components/BlogPostListAll'
|
||||
import BlogPostCard from './components/BlogPostCard'
|
||||
import Link from 'next/link'
|
||||
@@ -271,14 +270,7 @@ const LayoutSearch = (props) => {
|
||||
* @returns
|
||||
*/
|
||||
const LayoutArchive = (props) => {
|
||||
return <div {...props}></div>
|
||||
// const { archivePosts } = props
|
||||
|
||||
return <>
|
||||
<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>
|
||||
</>
|
||||
return <></>
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -325,27 +317,7 @@ const LayoutCategoryIndex = (props) => {
|
||||
* 标签列表
|
||||
*/
|
||||
const LayoutTagIndex = (props) => {
|
||||
return <div {...props}></div>
|
||||
// const { tagOptions } = props
|
||||
// const { locale } = useGlobal()
|
||||
|
||||
return <>
|
||||
<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" />
|
||||
{locale.COMMON.TAGS}:
|
||||
</div>
|
||||
<div id="tags-list" className="duration-200 flex flex-wrap">
|
||||
{tagOptions?.map(tag => {
|
||||
return (
|
||||
<div key={tag.name} className="p-2">
|
||||
<TagItemMini key={tag.name} tag={tag} />
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
return <></>
|
||||
}
|
||||
|
||||
export {
|
||||
|
||||
@@ -71,7 +71,7 @@ const LayoutBase = (props) => {
|
||||
const drawerRight = useRef(null)
|
||||
const floatSlot = <div className='block lg:hidden'>
|
||||
<TocDrawerButton onClick={() => {
|
||||
drawerRight?.current?.handleSwitchVisible()
|
||||
drawerRight?.current?.handleSwitchVisible()
|
||||
}} />
|
||||
</div>
|
||||
const tocRef = isBrowser ? document.getElementById('article-wrapper') : null
|
||||
@@ -114,7 +114,7 @@ const LayoutBase = (props) => {
|
||||
|
||||
{/* 右侧栏样式 */}
|
||||
{siteConfig('NEXT_RIGHT_BAR', null, CONFIG) && <SideAreaRight targetRef={targetRef} slot={rightAreaSlot} {...props} />}
|
||||
|
||||
|
||||
</main>
|
||||
|
||||
{/* 悬浮目录按钮 */}
|
||||
@@ -342,5 +342,5 @@ export {
|
||||
Layout404,
|
||||
LayoutCategoryIndex,
|
||||
LayoutPostList,
|
||||
LayoutTagIndex,
|
||||
LayoutTagIndex
|
||||
}
|
||||
|
||||
@@ -37,13 +37,13 @@ export const useNobeliumGlobal = () => useContext(ThemeGlobalNobelium)
|
||||
* @constructor
|
||||
*/
|
||||
const LayoutBase = props => {
|
||||
const { children, post, meta } = props
|
||||
const { children, post, meta } = props
|
||||
const fullWidth = post?.fullWidth ?? false
|
||||
const { onLoading } = useGlobal()
|
||||
const searchModal = useRef(null)
|
||||
// 在列表中进行实时过滤
|
||||
const [filterKey, setFilterKey] = useState('')
|
||||
const topSlot= <BlogListBar {...props}/>
|
||||
const topSlot = <BlogListBar {...props}/>
|
||||
|
||||
return (
|
||||
<ThemeGlobalNobelium.Provider value={{ searchModal, filterKey, setFilterKey }}>
|
||||
@@ -116,7 +116,7 @@ const LayoutIndex = props => {
|
||||
* @returns
|
||||
*/
|
||||
const LayoutPostList = props => {
|
||||
const { posts, topSlot,tag } = props
|
||||
const { posts, topSlot, tag } = props
|
||||
const { filterKey } = useNobeliumGlobal()
|
||||
let filteredBlogPosts = []
|
||||
if (filterKey && posts) {
|
||||
@@ -160,7 +160,7 @@ const LayoutSearch = props => {
|
||||
}, [])
|
||||
|
||||
// 在列表中进行实时过滤
|
||||
const {filterKey} = useNobeliumGlobal()
|
||||
const { filterKey } = useNobeliumGlobal()
|
||||
let filteredBlogPosts = []
|
||||
if (filterKey && posts) {
|
||||
filteredBlogPosts = posts.filter(post => {
|
||||
|
||||
@@ -290,5 +290,5 @@ export {
|
||||
Layout404,
|
||||
LayoutCategoryIndex,
|
||||
LayoutPostList,
|
||||
LayoutTagIndex,
|
||||
LayoutTagIndex
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user