"use client"; import { useAutoAnimate } from "@formkit/auto-animate/react"; import type { ReactNode } from "react"; import { useId, useState } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import classNames from "@calcom/ui/classNames"; import { InfoBadge } from "@calcom/ui/components/badge"; import { Button } from "@calcom/ui/components/button"; import { Icon } from "@calcom/ui/components/icon"; export function PanelCard({ title, subtitle, cta, headerContent, className, titleTooltip, children, collapsible = false, defaultCollapsed = false, ...dataAttributes }: { title: string | ReactNode; subtitle?: string; cta?: { label: string; onClick: () => void }; headerContent?: ReactNode; className?: string; titleTooltip?: string; children: ReactNode; collapsible?: boolean; defaultCollapsed?: boolean; } & Record<`data-${string}`, string | undefined>) { const { t } = useLocale(); const [isCollapsed, setIsCollapsed] = useState(defaultCollapsed); const contentId = useId(); const titleId = useId(); const [animationParent] = useAutoAnimate(); const toggleCollapse = () => { setIsCollapsed((prev) => !prev); }; const isStringTitle = typeof title === "string"; return (
{collapsible && ( ) : ( (title as string) )} {titleTooltip && }
) : ( title )}
{headerContent} {cta && ( )}
{!(isCollapsed && collapsible) && (
{subtitle && (

{subtitle}

)} {children}
)} ); }