Skip to content

Commit ea4daca

Browse files
committed
magzine - 移动端菜单OpenWrite限制
1 parent 7476b6d commit ea4daca

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

components/OpenWrite.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,14 @@ const OpenWrite = () => {
7979
return
8080
}
8181
if (isBrowser && blogId) {
82+
toggleTocItems(true) // 禁止目录项的点击
83+
8284
// Check if the element with id 'read-more-wrap' already exists
8385
const readMoreWrap = document.getElementById('read-more-wrap')
8486

8587
// Only load the script if the element doesn't exist
8688
if (!readMoreWrap) {
8789
loadOpenWrite()
88-
toggleTocItems(true) // 禁止目录项的点击
8990
}
9091
}
9192
})

themes/magzine/components/Catalog.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,22 @@ const Catalog = ({ toc, className }) => {
7070
<div
7171
className='overflow-y-auto scroll-hidden lg:max-h-dvh max-h-44'
7272
ref={tRef}>
73-
<nav className='h-full text-black'>
73+
<nav className='h-full text-black'>
7474
{toc.map(tocItem => {
7575
const id = uuidToId(tocItem.id)
7676
tocIds.push(id)
7777
return (
7878
<a
7979
key={id}
8080
href={`#${id}`}
81-
className={`notion-table-of-contents-item duration-300 transform dark:text-gray-300
81+
className={`notion-table-of-contents-item duration-300 transform dark:text-gray-400
8282
notion-table-of-contents-item-indent-level-${tocItem.indentLevel} `}>
8383
<span
8484
style={{
8585
display: 'inline-block',
8686
marginLeft: tocItem.indentLevel * 16
8787
}}
88-
className={`truncate ${activeSection === id ? 'font-bold text-gray-500 underline' : ''}`}>
88+
className={`truncate ${activeSection === id ? 'font-bold text-gray-500 dark:text-white underline' : ''}`}>
8989
{tocItem.text}
9090
</span>
9191
</a>

themes/magzine/components/Progress.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { useEffect, useState } from 'react'
21
import { isBrowser } from '@/lib/utils'
2+
import { useEffect, useState } from 'react'
33

44
/**
55
* 顶部页面阅读进度条
@@ -10,7 +10,8 @@ const Progress = ({ targetRef, showPercent = true }) => {
1010
const currentRef = targetRef?.current || targetRef
1111
const [percent, changePercent] = useState(0)
1212
const scrollListener = () => {
13-
const target = currentRef || (isBrowser && document.getElementById('article-wrapper'))
13+
const target =
14+
currentRef || (isBrowser && document.getElementById('article-wrapper'))
1415
if (target) {
1516
const clientHeight = target.clientHeight
1617
const scrollY = window.pageYOffset
@@ -28,13 +29,12 @@ const Progress = ({ targetRef, showPercent = true }) => {
2829
}, [])
2930

3031
return (
31-
<div className="h-4 w-full shadow-2xl bg-hexo-light-gray dark:bg-black">
32+
<div className='h-4 w-full shadow-2xl bg-hexo-light-gray dark:bg-black'>
3233
<div
33-
className="h-4 bg-gray-600 duration-200"
34-
style={{ width: `${percent}%` }}
35-
>
34+
className='h-4 bg-gray-600 dark:bg-hexo-black-gray duration-200'
35+
style={{ width: `${percent}%` }}>
3636
{showPercent && (
37-
<div className="text-right text-white text-xs">{percent}%</div>
37+
<div className='text-right text-white text-xs'>{percent}%</div>
3838
)}
3939
</div>
4040
</div>

0 commit comments

Comments
 (0)