import { X } from 'lucide-react' import { ButtonSubType, ButtonType, Button } from '../Button' import Block from '../Primitives/Block/Block' import PrimitiveText from '../Primitives/PrimitiveText/PrimitiveText' import { PopoverV2TokenType } from './popoverV2.token' import { PopoverV2Props, PopoverV2Size } from './popoverV2.types' import { type SkeletonVariant } from '../Skeleton' import PopoverV2Skeleton from './PopoverV2Skeleton' const PopoverV2Header = ({ popoverTokens, heading, description, showCloseButton, onClose, size = PopoverV2Size.MD, showSkeleton, skeletonVariant, headingId, descriptionId, }: Pick< PopoverV2Props, 'heading' | 'description' | 'showCloseButton' | 'size' | 'onClose' > & { showSkeleton?: boolean skeletonVariant?: SkeletonVariant headingId?: string descriptionId?: string popoverTokens: PopoverV2TokenType }) => { if (showSkeleton) { return ( ) } const hasHeading = Boolean( heading != null && (typeof heading !== 'string' || heading.trim() !== '') ) const hasDescription = Boolean( description != null && (typeof description !== 'string' || description.trim() !== '') ) if (showSkeleton) return null if (!hasHeading && !hasDescription) return null return ( {hasHeading && ( {heading} )} {showCloseButton && ( )} {hasDescription && ( {description} )} ) } PopoverV2Header.displayName = 'PopoverV2Header' export default PopoverV2Header