2017-09-25 02:06:28 +00: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 04:13:49 +00:00
|
|
|
<span className="sr-only">{level}</span>
|
|
|
|
<div className="Notification-message">{msg}</div>
|
2017-12-18 23:29:26 +00:00
|
|
|
<button className="Notification-close" aria-label="dismiss" onClick={this.onClose} />
|
2017-09-25 02:06:28 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public onClose = () => {
|
|
|
|
this.props.onClose(this.props.notification);
|
|
|
|
};
|
|
|
|
}
|