import React, { useContext } from 'react'
import { TabsProps } from '../../../../Components/Tabs'
import { SharedContext, defaultPaddingVariantsHeader } from '../utils'
import { Icon } from '../../../../Icons'
export const BoxHeader = React.memo(
({ children, title, subtitle, Tabs }: BoxHeaderProps) => {
const sharedProps = useContext(SharedContext)
const { variant, isOpen, toggleContent, isToggle } = sharedProps
const hasTitle = !!(title || subtitle || children)
const hasTabs = !!Tabs
return (
<>
(isToggle ? toggleContent() : undefined)}
>
{hasTitle && (
{title && (
{title}
)}
{subtitle && (
{subtitle}
)}
{children}
{isToggle && (
)}
)}
{hasTabs && (
)}
>
)
}
)
export interface BoxHeaderProps {
/**
* Title of the Box
*/
title?: string | React.ReactNode
/**
* Subtitle of the Box
*/
subtitle?: string | React.ReactNode
/**
* React children, use to render actions in Header
* Also support render prop
*/
children?: React.ReactNode | ((props: BoxHeaderProps) => React.ReactNode)
/**
* Use only with "<Tabs />" component
*/
Tabs?: React.ReactElement
}