2017-09-24 19:06:28 -07:00
|
|
|
import { Notification } from 'actions/notifications';
|
|
|
|
import classnames from 'classnames';
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
import './Notifications.scss';
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
notification: Notification;
|
|
|
|
onClose(n: Notification): void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default class NotificationRow extends Component<Props, {}> {
|
|
|
|
public render() {
|
|
|
|
const { msg, level } = this.props.notification;
|
|
|
|
const notifClass = classnames({
|
|
|
|
Notification: true,
|
|
|
|
alert: true,
|
|
|
|
[`alert-${level}`]: !!level
|
|
|
|
});
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={notifClass} role="alert" aria-live="assertive">
|
2017-10-04 00:13:49 -04:00
|
|
|
<span className="sr-only">{level}</span>
|
|
|
|
<div className="Notification-message">{msg}</div>
|
2017-12-18 18:29:26 -05:00
|
|
|
<button className="Notification-close" aria-label="dismiss" onClick={this.onClose} />
|
2017-09-24 19:06:28 -07:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public onClose = () => {
|
|
|
|
this.props.onClose(this.props.notification);
|
|
|
|
};
|
|
|
|
}
|