import classNames from "classnames"; import { noop } from "lodash"; import type { ComponentType, ReactNode } from "react"; import type { LucideIcon, LucideProps } from "@calcom/ui/components/icon"; import { X, AlertTriangle, Info } from "@calcom/ui/components/icon"; export type TopBannerProps = { Icon?: ComponentType & LucideIcon; text: string; variant?: keyof typeof variantClassName; actions?: ReactNode; onClose?: () => void; }; const variantClassName = { default: "bg-gradient-primary", warning: "bg-orange-400", error: "bg-red-400", }; const defaultIconProps = { className: "text-emphasis h-4 w-4 stroke-[2.5px]", "aria-hidden": "true", } as LucideProps; export function TopBanner(props: TopBannerProps) { const { Icon, variant = "default", text, actions, onClose } = props; const renderDefaultIconByVariant = () => { switch (variant) { case "error": return ; case "warning": return ; default: return null; } }; const defaultIcon = renderDefaultIconByVariant(); return (

{Icon ? : defaultIcon} {text}

{actions &&
{actions}
}
{typeof onClose === "function" && ( )}
); }