import { mdiClose } from '@mdi/js'; import React, { ReactNode, useState } from 'react'; import { ColorKey } from '../interfaces'; import { colorsBgLight, colorsOutline } from '../colors'; import BaseButton from './BaseButton'; import BaseIcon from './BaseIcon'; type Props = { color: ColorKey; icon?: string; outline?: boolean; children: ReactNode; button?: ReactNode; }; const NotificationBar = ({ outline = false, children, ...props }: Props) => { const componentColorClass = outline ? colorsOutline[props.color] : colorsBgLight[props.color]; const [isDismissed, setIsDismissed] = useState(false); const dismiss = (e: React.MouseEvent) => { e.preventDefault(); setIsDismissed(true); }; if (isDismissed) { return null; } return (
{props.icon && ( )} {children}
{props.button} {!props.button && ( )}
); }; export default NotificationBar;