2017-06-04 10:40:14 +08:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2016-08-10 00:28:16 +08:00
|
|
|
import cx from 'classnames';
|
2017-07-29 09:52:06 +08:00
|
|
|
import styles from './styles.scss';
|
2016-08-10 00:28:16 +08:00
|
|
|
|
|
|
|
const COLORS = [
|
|
|
|
'default', 'primary', 'danger', 'success',
|
|
|
|
];
|
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
color: PropTypes.oneOf(COLORS),
|
|
|
|
};
|
|
|
|
|
|
|
|
const defaultProps = {
|
|
|
|
color: 'default',
|
|
|
|
};
|
|
|
|
|
|
|
|
export default class NotificationsBar extends Component {
|
2017-07-29 09:52:06 +08:00
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
// to let the whiteboard know that the presentation area's size has changed
|
|
|
|
window.dispatchEvent(new Event('resize'));
|
|
|
|
}
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
|
|
|
// to let the whiteboard know that the presentation area's size has changed
|
|
|
|
window.dispatchEvent(new Event('resize'));
|
2016-08-10 00:28:16 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { color } = this.props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
role="alert"
|
2017-06-03 03:25:02 +08:00
|
|
|
className={cx(styles.notificationsBar, styles[color])}
|
|
|
|
>
|
2016-08-10 00:28:16 +08:00
|
|
|
{this.props.children}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
NotificationsBar.propTypes = propTypes;
|
|
|
|
NotificationsBar.defaultProps = defaultProps;
|