Skip to content

Commit f0e6a47

Browse files
Change styling for notifications to using USWDS alerts
Signed-off-by: Natalia Luzuriaga <natalia.luzuriaga@cms.hhs.gov>
1 parent 36b84f2 commit f0e6a47

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

index.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,11 @@ <h4 id="quiz-subheading">
246246
</div>
247247
</div>
248248

249-
<div id="notification" style="display: none;">
250-
<p id="notification-message"></p>
249+
<div class="usa-alert" id="notification" style="display:none;">
250+
<div class="usa-alert__body">
251+
<h4 class="usa-alert__heading"></h4>
252+
<p class="usa-alert__text" id="notification-message"></p>
253+
</div>
251254
</div>
252255

253256
<div id="auto-generation">

js/autoGenerateFields.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,17 @@ document.addEventListener("DOMContentLoaded", function () {
1010
const notificationSystem = {
1111
show: function (message, type = 'error') {
1212
const notification = document.getElementById('notification');
13-
const messageElement = document.getElementById('notification-message');
13+
const notificationHeading = document.querySelector('.usa-alert__heading')
14+
const messageElement = document.querySelector('.usa-alert__text');
1415

1516
messageElement.textContent = message;
1617

1718
if (type === 'error') {
18-
notification.style.backgroundColor = '#f8d7da';
19-
notification.style.color = '#721c24';
20-
notification.style.border = '1px solid #f5c6cb';
19+
notification.classList.add("usa-alert--error");
20+
notificationHeading.textContent = "Error";
2121
} else {
22-
notification.style.backgroundColor = '#d4edda';
23-
notification.style.color = '#155724';
24-
notification.style.border = '1px solid #c3e6cb';
22+
notification.classList.add("usa-alert--success");
23+
notificationHeading.textContent = "Success";
2524
}
2625

2726
notification.style.display = 'block';

0 commit comments

Comments
 (0)