PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.9.5
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.9.5
4.9.5 4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 All 203 releases
betterdocs / react-src / gutenberg / components / Header.js

Header.js in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 4.9.5, at react-src/gutenberg/components/Header.js

99 lines 3.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import React from 'react'
2 import { Counts, Icon, Title, GridCounts } from './partials';
3 import DownArrow from './partials/DownArrow';
4 import IconLayoutTwo from './partials/IconLayoutTwo';
5 import TitleLayoutTwo from './partials/TitleLayoutTwo';
6
7
8 const TitleCounts = ({ count, name, widgetType, attributes, showTitle, showCount, titleLink, showArrow, subcategoriesCount, docsCount, icon, lastUpdatedTime }) => {
9 const { layout, sidebar_layout } = attributes;
10 if( widgetType == 'category-grid' && layout === 'layout-2' ) {
11 return (
12 <>
13 {showCount && <GridCounts count={count} attributes={attributes} />}
14 {showTitle && <Title title={name} titleTag={ attributes?.titleTag && !titleLink ? 'h2' : 'a' } />}
15 </>
16 )
17 }
18 if( widgetType == 'category-box' && layout == 'layout-3' ) {
19 return (
20 <div className="betterdocs-dynamic-wrapper betterdocs-category-title-counts">
21 {showTitle && <Title title={name} titleTag={ attributes?.titleTag && !titleLink ? 'h2' : 'a' } />}
22 {showCount && <Counts count={count} attributes={attributes} />}
23 </div>
24 )
25 }
26
27 if( widgetType == 'category-box' && layout == 'layout-4' ) {
28 return <>
29 {attributes?.showIcon && <IconLayoutTwo icon={icon}/>}
30 <TitleLayoutTwo attributes={attributes} titleName={name} subcategoriesCount={subcategoriesCount} docsCount={docsCount} lastUpdatedTime={lastUpdatedTime}/>
31 </>
32 }
33
34 // Layout 8 (Slate Layout) - Hide count for sidebar
35 if( widgetType == 'category-grid' && sidebar_layout === 'layout-8' ) {
36 return (
37 <>
38 {showTitle && <Title title={name} titleTag={ attributes?.titleTag } />}
39 {showArrow && <DownArrow/>}
40 </>
41 )
42 }
43
44 return (
45 <>
46 {showTitle && <Title title={name} titleTag={ attributes?.titleTag } />}
47 {showCount && <Counts count={count} attributes={attributes} />}
48 {showArrow && <DownArrow/>}
49 </>
50 )
51 }
52
53 const Header = ({ attributes, thumbnail, name, count, widgetType, onClick, titleLink = false, subcategories_count = undefined, total_docs_count = undefined, last_updated_time = undefined }) => {
54 const {
55 showTitle = true,
56 showIcon = true,
57 showCount = true,
58 showArrow = false,
59 showLastUpdatedTime,
60 layout,
61 sidebar_layout
62 } = attributes;
63
64 let wrapperProps = {
65 className:'betterdocs-category-header'
66 };
67
68 if(typeof onClick == 'function' ) {
69 wrapperProps.onClick = onClick;
70 }
71
72 return (
73 <div {...wrapperProps}>
74 <div className='betterdocs-category-header-inner'>
75 { widgetType == 'category-grid' && layout !== 'layout-2' && layout !== 'layout-6' && layout !== 'layout-7' && sidebar_layout !== 'layout-8' && showIcon && <Icon icon={thumbnail} /> }
76 { widgetType == 'category-grid' && layout == 'layout-7' && showIcon && <IconLayoutTwo icon={thumbnail}/>}
77 { widgetType == 'category-box' && layout != 'layout-4' && showIcon && <Icon icon={thumbnail} /> }
78
79 <TitleCounts
80 showTitle={showTitle}
81 showCount={showCount}
82 subcategoriesCount={subcategories_count}
83 docsCount={total_docs_count}
84 name={name}
85 count={count}
86 widgetType={widgetType}
87 attributes={attributes}
88 titleLink={titleLink}
89 showArrow={showArrow}
90 icon={thumbnail}
91 lastUpdatedTime={last_updated_time}
92 />
93 </div>
94 </div>
95 )
96 }
97
98 export default Header
99