From 4cd32a8f03db1e5310e8d03f8b6b35027a3b91be Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Fri, 3 Nov 2023 23:24:53 +0800 Subject: [PATCH] little adjust --- themes/commerce/components/MenuItemDrop.js | 2 +- themes/commerce/index.js | 29 +++++++++++----------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/themes/commerce/components/MenuItemDrop.js b/themes/commerce/components/MenuItemDrop.js index cec4b854..e83f46f7 100644 --- a/themes/commerce/components/MenuItemDrop.js +++ b/themes/commerce/components/MenuItemDrop.js @@ -5,7 +5,7 @@ import { useState } from 'react' export const MenuItemDrop = ({ link }) => { const [show, changeShow] = useState(false) const hasSubMenu = link?.subMenus?.length > 0 - const selected = useRouter().asPath === link.to + const selected = useRouter().asPath === link?.to if (!link || !link.show) { return null diff --git a/themes/commerce/index.js b/themes/commerce/index.js index 00cb6362..b175c143 100644 --- a/themes/commerce/index.js +++ b/themes/commerce/index.js @@ -3,7 +3,6 @@ import CONFIG from './config' import CommonHead from '@/components/CommonHead' import { useEffect, useRef } from 'react' import Footer from './components/Footer' -// import SideRight from './components/SideRight' import { useGlobal } from '@/lib/global' import { isBrowser, scanAndConvertToLinks } from '@/lib/utils' import BlogPostListPage from './components/BlogPostListPage' @@ -16,9 +15,7 @@ import SearchNav from './components/SearchNav' import BlogPostArchive from './components/BlogPostArchive' import { ArticleLock } from './components/ArticleLock' import PostHeader from './components/PostHeader' -import JumpToCommentButton from './components/JumpToCommentButton' import TocDrawer from './components/TocDrawer' -import TocDrawerButton from './components/TocDrawerButton' import NotionPage from '@/components/NotionPage' import TagItemMini from './components/TagItemMini' import Link from 'next/link' @@ -215,16 +212,17 @@ 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 &&
- { - drawerRight?.current?.handleSwitchVisible() - }} - /> -
} - - + // const floatSlot = <> + // {post?.toc?.length > 1 &&
+ // { + // drawerRight?.current?.handleSwitchVisible() + // }} + // /> + //
} + // + // + const floatSlot = <> return ( } showCategory={false} showTag={false} floatSlot={floatSlot} > @@ -234,7 +232,9 @@ const LayoutSlug = props => { {!lock &&
{/* 预览区块 */} -
+ + {post?.type === 'Post' && ( +
@@ -245,6 +245,7 @@ const LayoutSlug = props => {
{post?.summary}
+ )}