From 969a31d7b142468a235b69e159d72ab5dbe578ca Mon Sep 17 00:00:00 2001 From: kmitresse Date: Sun, 5 May 2024 17:50:07 +0200 Subject: [PATCH] feat: devWeb - prepare a special invitation notification --- .../webapp/static/js/notification/invite.js | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 S2/DevWeb/Projet/src/main/webapp/static/js/notification/invite.js diff --git a/S2/DevWeb/Projet/src/main/webapp/static/js/notification/invite.js b/S2/DevWeb/Projet/src/main/webapp/static/js/notification/invite.js new file mode 100644 index 0000000..54b72ad --- /dev/null +++ b/S2/DevWeb/Projet/src/main/webapp/static/js/notification/invite.js @@ -0,0 +1,31 @@ +export function onInvite(invite) { + // Animations des champs + inputs.forEach(input => { + input.classList.add("is-info"); + input.style.animation = "shake 0.5s ease-in-out" + }); + + // Notification + const notification = document.createElement("div"); + notification.classList.add("notification", "is-danger"); + + const notificationTitle = document.createElement("p"); + notificationTitle.classList.add("title", "is-6"); + notificationTitle.innerHTML = "Erreur"; + + const notificationIcon = document.createElement("span"); + notificationIcon.classList.add("icon"); + notificationIcon.innerHTML = ""; + + const notificationMessage = document.createElement("p"); + notificationMessage.classList.add("subtitle", "is-6"); + notificationMessage.innerHTML = invite.message; + + notificationTitle.appendChild(notificationIcon); + notification.appendChild(notificationTitle); + notification.appendChild(notificationMessage); + document.body.appendChild(notification); + + // Retirer la notification et les animations après 5 secondes + setTimeout(() => notification.remove(), 5010); +};