diff --git a/.env.local b/.env.local index 7b9c9266..0c69e3c2 100644 --- a/.env.local +++ b/.env.local @@ -1,2 +1,2 @@ # 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables -NEXT_PUBLIC_VERSION=3.6.8 \ No newline at end of file +NEXT_PUBLIC_VERSION=3.7.0 diff --git a/components/Live2D.js b/components/Live2D.js index cb53df89..74522cc2 100644 --- a/components/Live2D.js +++ b/components/Live2D.js @@ -8,9 +8,11 @@ export default function Live2D() { const { switchTheme } = useGlobal() React.useEffect(() => { - window.addEventListener('scroll', initLive2D) - return () => { - window.removeEventListener('scroll', initLive2D) + if (BLOG.WIDGET_PET) { + window.addEventListener('scroll', initLive2D) + return () => { + window.removeEventListener('scroll', initLive2D) + } } }, []) @@ -34,14 +36,14 @@ function initLive2D() { window.removeEventListener('scroll', initLive2D) setTimeout(() => { // 加载 waifu.css live2d.min.js waifu-tips.js - if (screen.width >= 768) { - Promise.all([ - // loadExternalResource('https://cdn.zhangxinxu.com/sp/demo/live2d/live2d/js/live2d.js', 'js') - loadExternalResource('https://cdn.jsdelivr.net/gh/stevenjoezhang/live2d-widget@latest/live2d.min.js', 'js') - ]).then((e) => { - // https://github.com/xiazeyu/live2d-widget-models - loadlive2d('live2d', BLOG.WIDGET_PET_LINK) - }) - } + // if (screen.width >= 768) { + Promise.all([ + // loadExternalResource('https://cdn.zhangxinxu.com/sp/demo/live2d/live2d/js/live2d.js', 'js') + loadExternalResource('https://cdn.jsdelivr.net/gh/stevenjoezhang/live2d-widget@latest/live2d.min.js', 'js') + ]).then((e) => { + // https://github.com/xiazeyu/live2d-widget-models + loadlive2d('live2d', BLOG.WIDGET_PET_LINK) + }) + // } }, 300) } diff --git a/components/NotionPage.js b/components/NotionPage.js index 8739917f..429a6853 100644 --- a/components/NotionPage.js +++ b/components/NotionPage.js @@ -7,6 +7,8 @@ import Image from 'next/image' import Link from 'next/link' import { Code } from 'react-notion-x/build/third-party/code' +import 'katex/dist/katex.min.css' + const Equation = dynamic(() => import('react-notion-x/build/third-party/equation').then(async (m) => { // 化学方程式 diff --git a/components/PrismMac.js b/components/PrismMac.js index 956e9f73..11673d46 100644 --- a/components/PrismMac.js +++ b/components/PrismMac.js @@ -1,6 +1,7 @@ import React from 'react' import Prism from 'prismjs' import 'prismjs/plugins/toolbar/prism-toolbar' +import 'prismjs/plugins/toolbar/prism-toolbar.min.css' import 'prismjs/plugins/show-language/prism-show-language' import 'prismjs/plugins/copy-to-clipboard/prism-copy-to-clipboard' import 'prismjs/plugins/line-numbers/prism-line-numbers' @@ -70,7 +71,6 @@ const renderMermaid = async() => { function renderPrismMac() { const container = document?.getElementById('container-inner') - const codeToolBars = container?.getElementsByClassName('code-toolbar') // Add line numbers const codeBlocks = container?.getElementsByTagName('pre') @@ -93,6 +93,7 @@ function renderPrismMac() { console.log('代码渲染', err) } + const codeToolBars = container?.getElementsByClassName('code-toolbar') // Add pre-mac element for Mac Style UI if (codeToolBars) { Array.from(codeToolBars).forEach(item => { diff --git a/components/SideBarDrawer.js b/components/SideBarDrawer.js index ad988503..dac43d75 100644 --- a/components/SideBarDrawer.js +++ b/components/SideBarDrawer.js @@ -9,10 +9,6 @@ import React from 'react' const SideBarDrawer = ({ children, isOpen, onOpen, onClose, className }) => { const router = useRouter() React.useEffect(() => { - // 页面渲染后删除hidden属性 - // const sideBarWrapperElement = document.getElementById('sidebar-wrapper') - // sideBarWrapperElement?.classList?.remove('hidden') - const sideBarDrawerRouteListener = () => { switchSideDrawerVisible(false) } @@ -25,29 +21,30 @@ const SideBarDrawer = ({ children, isOpen, onOpen, onClose, className }) => { // 点击按钮更改侧边抽屉状态 const switchSideDrawerVisible = (showStatus) => { if (showStatus) { - onOpen() + onOpen && onOpen() } else { - onClose() + onClose && onClose() } const sideBarDrawer = window.document.getElementById('sidebar-drawer') const sideBarDrawerBackground = window.document.getElementById('sidebar-drawer-background') if (showStatus) { - sideBarDrawer.classList.replace('-ml-80', 'ml-0') + sideBarDrawer.classList.replace('-ml-56', 'ml-0') sideBarDrawerBackground.classList.replace('hidden', 'block') } else { - sideBarDrawer.classList.replace('ml-0', '-ml-80') + sideBarDrawer.classList.replace('ml-0', '-ml-56') sideBarDrawerBackground.classList.replace('block', 'hidden') } } - return
+ {post.summary} +
+ )} + {/* 搜索结果 */} + {post.results && ( ++ {post.results.map(r => ( + {r} + ))} +
+ )} + + +No posts found.
+ )} + {filteredBlogPosts.slice(0, 20).map(post => ( ++ {p.summary} +
++ {post.summary} +
++ {navBarTitle} +
+ ) + : ( ++ {BLOG.title},{' '} + {BLOG.description} +
+ )} ++ {tag} +
+ + +) + +export default TagItem diff --git a/themes/nobelium/components/Tags.js b/themes/nobelium/components/Tags.js new file mode 100644 index 00000000..4555bfae --- /dev/null +++ b/themes/nobelium/components/Tags.js @@ -0,0 +1,38 @@ +import Link from 'next/link' + +const Tags = (props) => { + const { tags, tag } = props + const currentTag = tag + if (!tags) return null + return ( ++ {description} +
+