// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React from 'react' import {Utils} from '../../utils' import IconButton from '../buttons/iconButton' import CloseIcon from '../icons/close' import Tooltip from '../tooltip' import './notificationBox.scss' type Props = { title: string icon?: React.ReactNode children?: React.ReactNode onClose?: () => void closeTooltip?: string className?: string } function renderClose(onClose?: () => void, closeTooltip?: string) { if (!onClose) { return null } if (closeTooltip) { return ( } onClick={onClose} /> ) } return ( } onClick={onClose} /> ) } function NotificationBox(props: Props): JSX.Element { const className = Utils.generateClassName({ NotificationBox: true, [props.className || '']: Boolean(props.className), }) return ( {props.icon && {props.icon} } {props.title} {props.children} {renderClose(props.onClose, props.closeTooltip)} ) } export default React.memo(NotificationBox)
{props.title}