This commit is contained in:
tangly1024
2022-01-05 14:46:47 +08:00
16 changed files with 47 additions and 14 deletions

View File

@@ -113,7 +113,6 @@ export default function ArticleDetail ({ post, blockMap, recommendPosts, prev, n
<section id='notion-article' className='px-1'>
{blockMap && (
<NotionRenderer
className={`${BLOG.font}`}
recordMap={blockMap}
mapPageUrl={mapPageUrl}
components={{

View File

@@ -21,7 +21,7 @@ const MenuButtonGroup = ({ allowCollapse = false }) => {
if (link.show) {
const selected = (router.pathname === link.to) || (router.asPath === link.to)
return <Link key={`${link.id}-${link.to}`} title={link.to} href={link.to} >
<a className={'py-1 my-1 px-5 mx-2 duration-300 text-base hover:bg-gray-500 hover:text-white hover:shadow-lg cursor-pointer font-light flex flex-nowrap items-center ' +
<a className={'py-1 my-1 px-5 mx-2 duration-300 text-base hover:bg-gray-700 hover:text-white hover:shadow-lg cursor-pointer font-light flex flex-nowrap items-center ' +
(selected ? 'bg-gray-200 text-black' : ' ')} >
<div className='my-auto justify-center flex '>
<FontAwesomeIcon icon={link.icon} />

View File

@@ -49,10 +49,10 @@ const PaginationNumber = ({ page, showNext, totalPage }) => {
function getPageElement (page, currentPage) {
return <Link href={`/page/${page}`} key={page} passHref>
<div className={(page + '' === currentPage ? 'font-bold bg-gray-500 dark:bg-gray-400 text-white ' : 'border-t-2 duration-500 border-white hover:border-gray-400 ') +
<a className={(page + '' === currentPage + '' ? 'font-bold bg-gray-500 dark:bg-gray-400 text-white ' : 'border-t-2 duration-500 border-white hover:border-gray-400 ') +
' border-white dark:border-gray-700 dark:hover:border-gray-400 cursor-pointer w-6 text-center font-light hover:font-bold'}>
{page}
</div>
</a>
</Link>
}
function generatePages (page, currentPage, totalPage) {

View File

@@ -18,7 +18,7 @@ const Tabs = ({ children }) => {
})
if (count === 1) {
return <section className='shadow'>
return <section className='shadow hover:shadow-xl duration-200'>
{children}
</section>
}

View File

@@ -37,6 +37,18 @@ const ThirdPartyScript = () => {
/>
</>)}
{/* */}
{BLOG.gitter && (<>
<script async dangerouslySetInnerHTML={{
__html: `
((window.gitter = {}).chat = {}).options = {
room: 'tangly1024/community'
};
`
}}/>
<script src="https://sidecar.gitter.im/dist/sidecar.v1.js" async defer></script>
</>)}
{/* 代码统计 */}
{BLOG.isProd && (<>

View File

@@ -1,4 +1,4 @@
import React, { useCallback } from 'react'
import React from 'react'
import throttle from 'lodash.throttle'
import { uuidToId } from 'notion-utils'
import Progress from './Progress'
@@ -12,8 +12,9 @@ import Progress from './Progress'
*/
const Toc = ({ toc, targetRef }) => {
// 无目录就直接返回空
if (!toc || toc.length < 1) return <></>
if (!toc || toc.length < 1) {
return <></>
}
// 监听滚动事件
React.useEffect(() => {
window.addEventListener('scroll', actionSectionScrollSpy)
@@ -26,7 +27,7 @@ const Toc = ({ toc, targetRef }) => {
// 同步选中目录事件
const [activeSection, setActiveSection] = React.useState(null)
const throttleMs = 100
const actionSectionScrollSpy = useCallback(throttle(() => {
const actionSectionScrollSpy = React.useCallback(throttle(() => {
const sections = document.getElementsByClassName('notion-h')
let prevBBox = null
let currentSectionId = activeSection