import clsx from "clsx"; import React from "react"; import { Button } from "../button"; import { Solid } from "../icon"; import { P } from "../typography"; import "./banner.scss"; export type BannerProps = { variant?: "info" | "success" | "warning" | "danger"; /** Whether to show an icon. */ withIcon?: boolean; /** Title of the banner */ title: string; /** Description text under the title */ description?: string; /** Button text for optional action button */ actionText?: string; /** Callback function when action button is clicked */ onActionClick?: () => void; }; /** * Banner component * @param title * @param description * @param variant * @param withIcon * @param actionText * @param onActionClick * @param props * @constructor */ export const Banner: React.FC = ({ title, description, variant = "info", withIcon = false, actionText, onActionClick, ...props }) => { const getIcon = () => { switch (variant) { case "danger": return ; case "info": return ; case "warning": return ; case "success": return ; default: return <>; } }; return (
{withIcon && getIcon()}

{title}

{description && (

{description}

)}
{actionText && onActionClick && ( )}
); };