bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/notifications-bar/component.jsx

48 lines
955 B
React
Raw Normal View History

import React from 'react';
import PropTypes from 'prop-types';
import injectWbResizeEvent from '/imports/ui/components/presentation/resize-wrapper/component';
2021-10-27 21:46:08 +08:00
import Styled from './styles';
const COLORS = [
'default', 'primary', 'danger', 'success',
];
const propTypes = {
2019-03-16 04:07:14 +08:00
color: PropTypes.string,
};
const defaultProps = {
color: 'default',
};
const NotificationsBar = (props) => {
2019-03-16 04:07:14 +08:00
const {
color,
children,
alert,
} = props;
2019-04-05 03:40:19 +08:00
const hasColor = COLORS.includes(color);
return (
2021-10-27 21:46:08 +08:00
<Styled.NotificationsBar
2022-01-20 21:03:18 +08:00
data-test="notificationBannerBar"
2019-03-16 04:07:14 +08:00
role={alert ? 'alert' : ''}
2019-02-15 22:44:57 +08:00
aria-live="off"
2019-03-16 04:07:14 +08:00
style={
!hasColor ? {
backgroundColor: `${color}`,
} : {}
2021-10-27 21:46:08 +08:00
}
color={color}
>
{children}
2021-10-27 21:46:08 +08:00
</Styled.NotificationsBar>
);
};
NotificationsBar.propTypes = propTypes;
NotificationsBar.defaultProps = defaultProps;
export default injectWbResizeEvent(NotificationsBar);