import React, { HTMLAttributes } from 'react' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faInfo, faExclamation, faExclamationTriangle, faCheck } from '@fortawesome/free-solid-svg-icons' import { Button } from '../Button/Button' import { variants } from '../Style' import { IconProp } from '@fortawesome/fontawesome-svg-core' export interface Props extends HTMLAttributes { variant?: 'success' | "warning" | "danger" | "info" title: string subtitle?: string text: string confirmationButton: string cancelButton?: boolean } export const Alert = ({variant = 'info', title, subtitle, text, confirmationButton, cancelButton, ...props}: Props) => { type VariantKey = keyof typeof variants const selectedVariant = variant as VariantKey const componentStyle = { backgroundColor: variants[selectedVariant].alertIconBgColor, color: variants[selectedVariant].alertIconFgColor } interface IIcons { [key: string]: IconProp } const icons: IIcons = { success: faCheck, warning: faExclamation, danger: faExclamationTriangle, info: faInfo, } return ( { title } { subtitle } { text } { cancelButton && Cancel } { confirmationButton } ) }
{ text }