import React from 'react'
import { Counts, Icon, Title, GridCounts } from './partials';
import DownArrow from './partials/DownArrow';
import IconLayoutTwo from './partials/IconLayoutTwo';
import TitleLayoutTwo from './partials/TitleLayoutTwo';
const TitleCounts = ({ count, name, widgetType, attributes, showTitle, showCount, titleLink, showArrow, subcategoriesCount, docsCount, icon, lastUpdatedTime }) => {
const { layout, sidebar_layout } = attributes;
if( widgetType == 'category-grid' && layout === 'layout-2' ) {
return (
<>
{showCount && }
{showTitle &&
}
>
)
}
if( widgetType == 'category-box' && layout == 'layout-3' ) {
return (
{showTitle &&
}
{showCount && }
)
}
if( widgetType == 'category-box' && layout == 'layout-4' ) {
return <>
{attributes?.showIcon && }
>
}
// Layout 8 (Slate Layout) - Hide count for sidebar
if( widgetType == 'category-grid' && sidebar_layout === 'layout-8' ) {
return (
<>
{showTitle && }
{showArrow && }
>
)
}
return (
<>
{showTitle && }
{showCount && }
{showArrow && }
>
)
}
const Header = ({ attributes, thumbnail, name, count, widgetType, onClick, titleLink = false, subcategories_count = undefined, total_docs_count = undefined, last_updated_time = undefined }) => {
const {
showTitle = true,
showIcon = true,
showCount = true,
showArrow = false,
showLastUpdatedTime,
layout,
sidebar_layout
} = attributes;
let wrapperProps = {
className:'betterdocs-category-header'
};
if(typeof onClick == 'function' ) {
wrapperProps.onClick = onClick;
}
return (
{ widgetType == 'category-grid' && layout !== 'layout-2' && layout !== 'layout-6' && layout !== 'layout-7' && sidebar_layout !== 'layout-8' && showIcon && }
{ widgetType == 'category-grid' && layout == 'layout-7' && showIcon && }
{ widgetType == 'category-box' && layout != 'layout-4' && showIcon && }
)
}
export default Header