import React, { FunctionComponent, HTMLAttributes, ReactNode } from 'react'; import { classNames } from '../../lib/classNames'; import { getClassName } from '../../helpers/getClassName'; import Tappable from '../Tappable/Tappable'; import { usePlatform } from '../../hooks/usePlatform'; import { hasReactNode } from '../../lib/utils'; import Caption from '../Typography/Caption/Caption'; import Headline from '../Typography/Headline/Headline'; export interface PanelHeaderContentProps extends HTMLAttributes { aside?: ReactNode; before?: ReactNode; status?: ReactNode; } const PanelHeaderContent: FunctionComponent = ({ className, style, aside, status, before, children, onClick, ...restProps }: PanelHeaderContentProps) => { const InComponent = onClick ? Tappable : 'div'; const rootProps = onClick ? {} : restProps; const inProps = onClick ? { ...restProps, activeEffectDelay: 200 } : {}; const platform = usePlatform(); const baseClassNames = getClassName('PanelHeaderContent', platform); return ( {hasReactNode(before) && {before}} {hasReactNode(status) && {status} } {hasReactNode(status) ? {children} : {children} } {hasReactNode(aside) && {aside}} {hasReactNode(before) && } ); }; export default PanelHeaderContent;