import React, { FC } from 'react'
import { useTheme } from '../hooks'
import { NotificationType, FormNotification } from '../types'

interface Props {
    notification: FormNotification
}

const Notification: FC<Props> = ({ notification }) => {
    const theme = useTheme()
    let color = theme.text

    switch (notification.type) {
        case NotificationType.Error:
            color = theme.red
            break
        case NotificationType.Success:
            color = theme.green
    }

    return (
        <p className="help" style={{ color }}>{notification.message}</p>
    )
}

export default Notification
