Skip to content

Commit 26547d8

Browse files
committed
修复Next主题bug
1 parent b16aadf commit 26547d8

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

themes/next/components/JumpToBottomButton.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ const JumpToBottomButton = ({ showPercent = false }) => {
1818
return () => document.removeEventListener('scroll', scrollListener)
1919
}, [show])
2020

21-
if (!CONFIG_NEXT.WIDGET_TO_BOTTOM) {
22-
return <></>
23-
}
24-
2521
const scrollListener = () => {
2622
const targetRef = document.getElementById('wrapper')
2723
const clientHeight = targetRef?.clientHeight
@@ -41,6 +37,10 @@ const JumpToBottomButton = ({ showPercent = false }) => {
4137
window.scrollTo({ top: targetRef.clientHeight, behavior: 'smooth' })
4238
}
4339

40+
if (!CONFIG_NEXT.WIDGET_TO_BOTTOM) {
41+
return <></>
42+
}
43+
4444
return (<div className='flex space-x-1 transform hover:scale-105 duration-200 py-2 px-3' onClick={scrollToBottom} >
4545
<div className='dark:text-gray-200' >
4646
<i className='fas fa-arrow-down' />

themes/next/components/JumpToTopButton.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import CONFIG_NEXT from '../config_next'
1111
* @constructor
1212
*/
1313
const JumpToTopButton = ({ showPercent = true, percent }) => {
14+
const { locale } = useGlobal()
1415
if (!CONFIG_NEXT.WIDGET_TO_TOP) {
1516
return <></>
1617
}
17-
const { locale } = useGlobal()
1818
return (<div className='flex space-x-1 items-center transform hover:scale-105 duration-200 py-2 px-3' onClick={() => window.scrollTo({ top: 0, behavior: 'smooth' })} >
1919
<div className='dark:text-gray-200' title={locale.POST.TOP} >
2020
<i className='fa-arrow-up fas' />

themes/next/components/SideAreaRight.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const NextRecentComments = dynamic(() => import('./NextRecentComments'))
2222
* @constructor
2323
*/
2424
const SideAreaRight = (props) => {
25-
const { tags, currentTag, slot, categories, currentCategory, notice } = props
25+
const { tagOptions, currentTag, slot, categoryOptions, currentCategory, notice } = props
2626
const { locale } = useGlobal()
2727
const router = useRouter()
2828
return (<aside id='right' className={(BLOG.LAYOUT_SIDEBAR_REVERSE ? 'mr-4' : 'ml-4') + ' space-y-4 hidden 2xl:block flex-col w-60 relative z-10'}>
@@ -50,7 +50,7 @@ const SideAreaRight = (props) => {
5050
{slot}
5151

5252
{/* 分类 */}
53-
{CONFIG_NEXT.RIGHT_CATEGORY_LIST && router.asPath !== '/category' && categories && (
53+
{CONFIG_NEXT.RIGHT_CATEGORY_LIST && router.asPath !== '/category' && categoryOptions && (
5454
<Card>
5555
<div className='text-sm px-2 flex flex-nowrap justify-between font-light'>
5656
<div className='pb-2 text-gray-600 dark:text-gray-300'><i className='mr-2 fas fa-th-list' />{locale.COMMON.CATEGORY}</div>
@@ -63,11 +63,11 @@ const SideAreaRight = (props) => {
6363

6464
</Link>
6565
</div>
66-
<CategoryGroup currentCategory={currentCategory} categories={categories} />
66+
<CategoryGroup currentCategory={currentCategory} categories={categoryOptions} />
6767
</Card>
6868
)}
6969

70-
{CONFIG_NEXT.RIGHT_TAG_LIST && router.asPath !== '/tag' && tags && (
70+
{CONFIG_NEXT.RIGHT_TAG_LIST && router.asPath !== '/tag' && tagOptions && (
7171
<Card>
7272
<div className="text-sm pb-1 px-2 flex flex-nowrap justify-between font-light dark:text-gray-200">
7373
<div className="text-gray-600 dark:text-gray-200">
@@ -85,7 +85,7 @@ const SideAreaRight = (props) => {
8585
</Link>
8686
</div>
8787
<div className="px-2 pt-2">
88-
<TagGroups tags={tags} currentTag={currentTag} />
88+
<TagGroups tags={tagOptions} currentTag={currentTag} />
8989
</div>
9090
</Card>
9191
)}

0 commit comments

Comments
 (0)