import React from 'react' type AlertType = 'success' | 'info' | 'warning' | 'danger' const icons = new Map([ ['success', 'check'], ['info', 'info'], ['warning', 'exclamation-triangle'], ['danger', 'times-circle'], ]) interface Props { type: AlertType } const Alert: React.FC = (props) => { const { type } = props const icon = icons.get(type) return props.children ? (
{props.children}
) : null } export default Alert