Skip to content

Commit 141e4de

Browse files
committed
fix notifications
1 parent 2d4a4fb commit 141e4de

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

31-password generator/script.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ const randomFunctions = {
3131
symbol: getRandomSymbol,
3232
};
3333

34+
const createNotification = (message) => {
35+
const notif = document.createElement("div");
36+
notif.classList.add("toast");
37+
notif.innerText = message;
38+
document.body.appendChild(notif);
39+
setTimeout(() => notif.remove(), 3000);
40+
};
41+
3442
clipboardElement.addEventListener("click", () => {
3543
const password = resultElement.innerText;
3644
if (!password) return;
@@ -40,7 +48,7 @@ clipboardElement.addEventListener("click", () => {
4048
textarea.select();
4149
document.execCommand("copy");
4250
textarea.remove();
43-
alert("Password copied to clipboard!");
51+
createNotification("Password copied to clipboard!");
4452
});
4553

4654
generateElement.addEventListener("click", () => {

31-password generator/style.css

+11
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,14 @@ h2 {
7878
align-items: center;
7979
margin: 15px 0;
8080
}
81+
82+
.toast {
83+
position: fixed;
84+
bottom: 10px;
85+
right: 10px;
86+
background-color: #fff;
87+
color: #3b3b98;
88+
border-radius: 5px;
89+
padding: 1rem 2rem;
90+
margin: 0.5rem;
91+
}

66-meal finder/script.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function searchMeal(e) {
3434
});
3535
search.value = "";
3636
} else {
37-
alert("Please enter a search term");
37+
getRandomMeal();
3838
}
3939
}
4040

0 commit comments

Comments
 (0)