/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ import * as React from 'react' import { StyledWrapper, StyledContent, StyledClose, StyledIcon, StyledError, StyledSuccess, StyledWarning } from './style' import { AlertCircleIcon, CheckCircleIcon, CloseCircleOIcon, CloseStrokeIcon } from '../../../components/icons' export type Type = 'error' | 'success' | 'warning' export interface Props { type: Type id?: string children?: React.ReactNode onClose?: () => void colored?: boolean bg?: boolean } export default class Alert extends React.PureComponent { get icon () { switch (this.props.type) { case 'error': return ( ) case 'success': return ( ) case 'warning': return ( ) } return null } render () { const { id, children, onClose, colored, bg, type } = this.props return ( {this.icon} {children} {onClose ? ( ) : null} ) } }