File tree 2 files changed +14
-9
lines changed
2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -244,6 +244,8 @@ const BLOG = {
244
244
// ********挂件组件相关********
245
245
// ----> 评论互动 可同时开启多个支持 WALINE VALINE GISCUS CUSDIS UTTERRANCES GITALK
246
246
247
+ COMMENT_HIDE_SINGLE_TAB : process . env . NEXT_PUBLIC_COMMENT_HIDE_SINGLE_TAB || false , //Whether hide the tab when there's no tabs. 只有一个评论组件时是否隐藏切换组件的标签页
248
+
247
249
// artalk 评论插件
248
250
COMMENT_ARTALK_SERVER : process . env . NEXT_PUBLIC_COMMENT_ARTALK_SERVER || '' , // ArtalkServert后端地址 https://artalk.js.org/guide/deploy.html
249
251
COMMENT_ARTALK_JS : process . env . NEXT_PUBLIC_COMMENT_ARTALK_JS || 'https://cdnjs.cloudflare.com/ajax/libs/artalk/2.5.5/Artalk.js' , // ArtalkServert js cdn
Original file line number Diff line number Diff line change 1
1
import { useState } from 'react' ;
2
+ import { siteConfig } from '@/lib/config'
2
3
3
4
/**
4
5
* Tabs切换标签
@@ -16,15 +17,17 @@ const Tabs = ({ className, children }) => {
16
17
17
18
return (
18
19
< div className = { `mb-5 duration-200 ${ className } ` } >
19
- < ul className = "flex justify-center space-x-5 pb-4 dark:text-gray-400 text-gray-600 overflow-auto" >
20
- { validChildren . map ( ( item , index ) => (
21
- < li key = { index }
22
- className = { `${ currentTab === index ? 'font-black border-b-2 border-red-600 text-red-600 animate__animated animate__jello' : 'font-extralight cursor-pointer' } text-sm font-sans` }
23
- onClick = { ( ) => setCurrentTab ( index ) } >
24
- { item . key }
25
- </ li >
26
- ) ) }
27
- </ ul >
20
+ { ! ( validChildren . length === 1 && siteConfig ( 'COMMENT_HIDE_SINGLE_TAB' ) ) && (
21
+ < ul className = "flex justify-center space-x-5 pb-4 dark:text-gray-400 text-gray-600 overflow-auto" >
22
+ { validChildren . map ( ( item , index ) => (
23
+ < li key = { index }
24
+ className = { `${ currentTab === index ? 'font-black border-b-2 border-red-600 text-red-600 animate__animated animate__jello' : 'font-extralight cursor-pointer' } text-sm font-sans` }
25
+ onClick = { ( ) => setCurrentTab ( index ) } >
26
+ { item . key }
27
+ </ li >
28
+ ) ) }
29
+ </ ul >
30
+ ) }
28
31
{ /* 标签切换的时候不销毁 DOM 元素,使用 CSS 样式进行隐藏 */ }
29
32
< div >
30
33
{ validChildren . map ( ( item , index ) => (
You can’t perform that action at this time.
0 commit comments