Skip to content
Snippets Groups Projects
Unverified Commit 9a7f18ae authored by Anton Georgiev's avatar Anton Georgiev Committed by GitHub
Browse files

Merge pull request #6722 from KDSBrowne/2.2-breakout-SR-timer

Prevent SR seeing timer notifications as alerts
parents 51e3cac2 af3fcb81
No related branches found
No related tags found
No related merge requests found
......@@ -16,12 +16,19 @@ const defaultProps = {
color: 'default',
};
const isTimedAlert = (alertString) => {
// checks if the notification string contains a timer
const endsWithTime = alertString.match(/[0-9]*:[0-9]{2}$/i);
const hasCounter = alertString.match(/[ ][0-9]*[ ]/i);
return !!(hasCounter || endsWithTime);
};
const NotificationsBar = (props) => {
const { color, children } = props;
return (
<div
role="alert"
role={isTimedAlert(children) ? '' : 'alert'}
className={cx(styles.notificationsBar, styles[color])}
>
{children}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment