Skip to content

Commit 1486b94

Browse files
Otto WachterOtto Wachter
Otto Wachter
authored and
Otto Wachter
committed
es4 module
1 parent e46ecdd commit 1486b94

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

js/modules/es4/toast.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const toastModule = new function() {
3838
// Create the container for the toasts
3939
createContainer(position) {
4040
const container = document.createElement('div');
41-
container.className = `enable-toast enable-toast--${position}`;
41+
container.className = `enable-toast__container enable-toast__container--${position}`;
4242
return container;
4343
}
4444

@@ -57,7 +57,7 @@ const toastModule = new function() {
5757
toastElement.offsetHeight; // Force reflow to ensure the element is rendered before adding the visible class
5858

5959
setTimeout(() => {
60-
toastElement.classList.add('enable-toast--visible');
60+
toastElement.classList.add('enable-toast__item--visible');
6161
}, 100); // Slight delay to ensure screen readers catch the change
6262

6363
// Update the toast rack with the new toast
@@ -66,7 +66,7 @@ const toastModule = new function() {
6666
this.updateToggleRackButton();
6767
}
6868

69-
// Create the individual toast element
69+
// Create the individual toast element (Using enable-toast__item)
7070
createToastElement(toastData) {
7171
const { message, level, id } = toastData;
7272
const toast = document.createElement('div');
@@ -98,7 +98,7 @@ const toastModule = new function() {
9898
dismissToast(toastData) {
9999
const toastElement = this.container.querySelector(`[data-id="${toastData.id}"]`);
100100
if (toastElement) {
101-
toastElement.classList.add('enable-toast--exit');
101+
toastElement.classList.add('enable-toast__item--exit');
102102
setTimeout(() => {
103103
toastElement.remove();
104104
this.visibleQueue = this.visibleQueue.filter(t => t.id !== toastData.id);
@@ -123,9 +123,9 @@ const toastModule = new function() {
123123
this.visibleQueue.forEach((toast, index) => {
124124
const toastElement = this.container.querySelector(`[data-id="${toast.id}"]`);
125125
if (index < this.maxVisible) {
126-
toastElement.classList.add('enable-toast--visible');
126+
toastElement.classList.add('enable-toast__item--visible');
127127
} else {
128-
toastElement.classList.remove('enable-toast--visible');
128+
toastElement.classList.remove('enable-toast__item--visible');
129129
}
130130
});
131131

@@ -146,7 +146,7 @@ const toastModule = new function() {
146146
this.toastQueue.forEach(toastData => {
147147
const { message, level, id } = toastData;
148148
const toastElement = document.createElement('div');
149-
toastElement.className = 'enable-toast__item enable-toast--visible';
149+
toastElement.className = 'enable-toast__item enable-toast__item--visible';
150150
toastElement.style.backgroundColor = this.levels[level]?.color || '#333';
151151
toastElement.setAttribute('data-id', id);
152152

0 commit comments

Comments
 (0)