diff --git a/README.md b/README.md index 0eae28b5..fffcc637 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ yarn run start # 本地启动NextJS服务 haixin1225
haixin1225

🔧 🐛 - mouyase
haixin1225

🔧 🐛 + mouyase
mouyase

🔧 🐛 diff --git a/components/NotionPage.js b/components/NotionPage.js index e3d0a053..a6f0a8ce 100644 --- a/components/NotionPage.js +++ b/components/NotionPage.js @@ -77,7 +77,7 @@ const NotionPage = ({ post }) => { addWatch4Dom() }, []) - return
+ return
{ - if (post.type === 'Post' && (post.status === 'Published' || post.status === 'Invisible')) { + if (post.type === 'Post' && post.status === 'Published') { postCount++ } diff --git a/pages/[...slug].js b/pages/[...slug].js index 015f053f..97327526 100644 --- a/pages/[...slug].js +++ b/pages/[...slug].js @@ -98,7 +98,7 @@ export async function getStaticProps({ params: { slug } }) { // slug 是个数组 const fullSlug = slug.join('/') const from = `slug-props-${fullSlug}` - const props = await getGlobalNotionData({ from, pageType: ['Post'] }) + const props = await getGlobalNotionData({ from }) props.post = props.allPages.find((p) => { return p.slug === fullSlug || p.id === idToUuid(fullSlug) }) diff --git a/pages/archive/index.js b/pages/archive/index.js index 098da940..ed40b48a 100644 --- a/pages/archive/index.js +++ b/pages/archive/index.js @@ -21,7 +21,7 @@ const ArchiveIndex = props => { export async function getStaticProps() { const props = await getGlobalNotionData({ from: 'archive-index' }) const { allPages } = props - const allPosts = allPages.filter(page => page.type === 'Post') + const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published') // 处理分页 props.posts = allPosts return { diff --git a/pages/category/[category].js b/pages/category/[category].js index 6c07adcf..6082c336 100644 --- a/pages/category/[category].js +++ b/pages/category/[category].js @@ -27,7 +27,7 @@ export async function getStaticProps({ params: { category } }) { const from = 'category-props' let props = await getGlobalNotionData({ from }) const { allPages } = props - const allPosts = allPages.filter(page => page.type === 'Post') + const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published') const posts = allPosts.filter( post => post && post.category && post.category.includes(category) ) diff --git a/pages/index.js b/pages/index.js index 3c49f983..92a70474 100644 --- a/pages/index.js +++ b/pages/index.js @@ -13,7 +13,7 @@ export async function getStaticProps() { const from = 'index' const props = await getGlobalNotionData({ from }) const { allPages, siteInfo } = props - const allPosts = allPages.filter(page => page.type === 'Post') + const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published') const meta = { title: `${siteInfo?.title} | ${siteInfo?.description}`, description: siteInfo?.description, diff --git a/pages/page/[page].js b/pages/page/[page].js index a7b49e82..a09f08d1 100644 --- a/pages/page/[page].js +++ b/pages/page/[page].js @@ -39,7 +39,7 @@ export async function getStaticProps({ params: { page } }) { const props = await getGlobalNotionData({ from }) props.page = page const { allPages } = props - const allPosts = allPages.filter(page => page.type === 'Post') + const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published') // 处理分页 props.posts = allPosts.slice( BLOG.POSTS_PER_PAGE * (page - 1), diff --git a/pages/search/[keyword].js b/pages/search/[keyword].js index dc992481..e478920d 100644 --- a/pages/search/[keyword].js +++ b/pages/search/[keyword].js @@ -36,7 +36,7 @@ export async function getStaticProps({ params: { keyword } }) { pageType: ['Post'] }) const { allPages } = props - const allPosts = allPages.filter(page => page.type === 'Post') + const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published') props.posts = await filterByMemCache(allPosts, keyword) props.keyword = keyword return { diff --git a/pages/search/index.js b/pages/search/index.js index 7cee6392..4dd96ad5 100644 --- a/pages/search/index.js +++ b/pages/search/index.js @@ -53,7 +53,7 @@ export async function getStaticProps() { pageType: ['Post'] }) const { allPages } = props - const allPosts = allPages.filter(page => page.type === 'Post') + const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published') props.posts = allPosts return { props, diff --git a/pages/tag/[tag].js b/pages/tag/[tag].js index 37606158..875a8768 100644 --- a/pages/tag/[tag].js +++ b/pages/tag/[tag].js @@ -29,7 +29,7 @@ export async function getStaticProps({ params: { tag } }) { tagsCount: 0 }) const { allPages } = props - const allPosts = allPages.filter(page => page.type === 'Post') + const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published') props.posts = allPosts.filter( post => post && post.tags && post.tags.includes(tag) ) diff --git a/styles/notion.css b/styles/notion.css index f6a28c5b..4dc32e95 100644 --- a/styles/notion.css +++ b/styles/notion.css @@ -179,6 +179,10 @@ color: var(--select-color-2) !important; } +.notion-simple-table { + @apply whitespace-nowrap overflow-x-scroll block +} + .notion-app { position: relative; background: var(--bg-color); @@ -197,8 +201,8 @@ .medium-zoom-overlay { z-index: 300; - -webkit-backdrop-filter: blur(5px); - backdrop-filter: blur(5px); + -webkit-backdrop-filter: blur(5px); + backdrop-filter: blur(5px); } .medium-zoom-image { @@ -657,6 +661,10 @@ svg.notion-page-icon { list-style-type: lower-alpha; } +.notion-list-numbered > .notion-list-numbered > .notion-list-numbered { + list-style-type: lower-roman; + } + .notion-list-disc li { padding-left: 0.1em; } diff --git a/themes/next/LayoutBase.js b/themes/next/LayoutBase.js index 7f64181b..f3b9dc44 100644 --- a/themes/next/LayoutBase.js +++ b/themes/next/LayoutBase.js @@ -9,7 +9,7 @@ import SideAreaRight from './components/SideAreaRight' import TopNav from './components/TopNav' import { useGlobal } from '@/lib/global' import PropTypes from 'prop-types' -import React, { useEffect, useRef, useState } from 'react' +import React from 'react' import smoothscroll from 'smoothscroll-polyfill' import CONFIG_NEXT from './config_next' import Live2D from '@/components/Live2D' @@ -22,11 +22,12 @@ import Live2D from '@/components/Live2D' const LayoutBase = (props) => { const { children, headerSlot, meta, sideBarSlot, floatSlot, rightAreaSlot, siteInfo } = props const { onLoading } = useGlobal() - const targetRef = useRef(null) + const targetRef = React.useRef(null) + const floatButtonGroup = React.useRef(null) const leftAreaSlot = - const [show, switchShow] = useState(false) - const [percent, changePercent] = useState(0) // 页面阅读百分比 + const [show, switchShow] = React.useState(false) + const [percent, changePercent] = React.useState(0) // 页面阅读百分比 const scrollListener = () => { const targetRef = document.getElementById('wrapper') const clientHeight = targetRef?.clientHeight @@ -41,8 +42,18 @@ const LayoutBase = (props) => { } changePercent(per) } - useEffect(() => { + + React.useEffect(() => { smoothscroll.polyfill() + + // facebook messenger 插件需要调整右下角悬浮按钮的高度 + const fb = document.getElementsByClassName('fb-customerchat') + if (fb.length === 0) { + floatButtonGroup?.current?.classList.replace('bottom-24', 'bottom-12') + } else { + floatButtonGroup?.current?.classList.replace('bottom-12', 'bottom-24') + } + document.addEventListener('scroll', scrollListener) return () => document.removeEventListener('scroll', scrollListener) }, [show]) @@ -62,11 +73,12 @@ const LayoutBase = (props) => {
{onLoading ? : <> {children} }
- + {/* 右侧栏样式 */} + { CONFIG_NEXT.RIGHT_BAR && } {/* 右下角悬浮 */} -
+
diff --git a/themes/next/components/SideAreaRight.js b/themes/next/components/SideAreaRight.js index 6a0abd51..d5ccfe15 100644 --- a/themes/next/components/SideAreaRight.js +++ b/themes/next/components/SideAreaRight.js @@ -22,9 +22,6 @@ import BLOG from '@/blog.config' const SideAreaRight = (props) => { const { tags, currentTag, slot, categories, currentCategory } = props const { locale } = useGlobal() - if (!CONFIG_NEXT.RIGHT_BAR) { - return <> - } const router = useRouter() return (