Skip to content

Commit fac567d

Browse files
committed
notificationArea changed
1 parent fc38a78 commit fac567d

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

app/javascript/src/utils/notificationHelper.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,34 @@ import { isString, isObject } from './isType';
77

88
export function hideNotifications() {
99
$('#notification-area')
10-
.addClass('hide')
10+
.addClass('d-none')
1111
.removeClass('notification-area--floating');
1212
}
1313

1414
function renderMessage(options = {}) {
1515
const notificationArea = $('#notification-area');
1616

1717
if (isString(options.message) && isObject(notificationArea)) {
18-
notificationArea
19-
.removeClass('alert-info', 'alert-warning')
20-
.addClass(options.className);
2118

2219
if (options.floating) {
2320
notificationArea.addClass('notification-area--floating');
2421
}
22+
23+
// Remove class
24+
if (options.removeClass) {
25+
notificationArea.removeClass('alert-info');
26+
notificationArea.removeClass('alert-warning');
27+
}
28+
29+
notificationArea.addClass(options.className);
2530

2631
notificationArea.find('i, span').remove();
2732
notificationArea.append(`
2833
<i class="fas fa-${options.icon}" aria-hidden="true"></i>
2934
<span>${options.message}</span>
3035
`);
3136

32-
notificationArea.removeClass('hide');
37+
notificationArea.removeClass('d-none');
3338

3439
if (options.autoDismiss) {
3540
setTimeout(() => { hideNotifications(); }, 5000);
@@ -42,6 +47,7 @@ export function renderNotice(msg, options = {}) {
4247
message: msg,
4348
icon: 'circle-check',
4449
className: 'alert-info',
50+
removeClass: true,
4551
floating: options.floating === true,
4652
autoDismiss: options.autoDismiss === true,
4753
});
@@ -52,6 +58,7 @@ export function renderAlert(msg, options = {}) {
5258
message: msg,
5359
icon: 'circle-xmark',
5460
className: 'alert-warning',
61+
removeClass: true,
5562
floating: options.floating === true,
5663
autoDismiss: options.autoDismiss === true,
5764
});

0 commit comments

Comments
 (0)