From 22a9037b123d257d9b249be54cf51216fded449e Mon Sep 17 00:00:00 2001 From: Azmat Ali Date: Sat, 14 Mar 2026 11:06:36 +0530 Subject: [PATCH] refactor(toast): implemented toast.js refactored 'showToast' and updated pages accordingly --- assets/js/toast.js | 16 ++++++++++++++++ checkout.html | 7 +++++++ index.html | 29 +++++++++++------------------ product.html | 29 ++++++++++------------------- 4 files changed, 44 insertions(+), 37 deletions(-) create mode 100644 assets/js/toast.js diff --git a/assets/js/toast.js b/assets/js/toast.js new file mode 100644 index 0000000..bd0bcda --- /dev/null +++ b/assets/js/toast.js @@ -0,0 +1,16 @@ +function showToast(options) { + if (!options) return; + + const toast = document.getElementById("toast"); + const tMsg = document.getElementById("toast-msg"); + const tIcon = document.getElementById("toast-icon"); + + tMsg.textContent = options.title; + tIcon.textContent = options.icon; + + toast.classList.add("show"); + + setTimeout(() => { + toast.classList.remove("show"); + }, 3500); +} diff --git a/checkout.html b/checkout.html index 31f05f9..490b01b 100644 --- a/checkout.html +++ b/checkout.html @@ -85,6 +85,7 @@