Skip to content

Commit a185f64

Browse files
authored
Add Hover Effects to Confirmation Modal Buttons (sugarlabs#4473)
* Add hover effects to Confirm and Cancel buttons in confirmation modal * Add blueButtonHover and cancelButtonHover to light/dark themes for consistent styling * Refactor renderClearConfirmation to use platformColor for button hover effects
1 parent ab40945 commit a185f64

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

js/activity.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,13 @@ class Activity {
13851385
confirmBtn.style.fontWeight = "bold";
13861386
confirmBtn.style.cursor = "pointer";
13871387
confirmBtn.style.marginRight = "16px";
1388+
confirmBtn.style.transition = "background-color 0.2s ease";
1389+
confirmBtn.addEventListener("mouseover", () => {
1390+
confirmBtn.style.backgroundColor = platformColor.blueButtonHover;
1391+
});
1392+
confirmBtn.addEventListener("mouseout", () => {
1393+
confirmBtn.style.backgroundColor = platformColor.blueButton;
1394+
});
13881395
confirmBtn.addEventListener("click", () => {
13891396
document.body.removeChild(modal);
13901397
clearCanvasAction();
@@ -1399,6 +1406,13 @@ class Activity {
13991406
cancelBtn.style.padding = "8px 16px";
14001407
cancelBtn.style.fontWeight = "bold";
14011408
cancelBtn.style.cursor = "pointer";
1409+
cancelBtn.style.transition = "background-color 0.2s ease";
1410+
cancelBtn.addEventListener("mouseover", () => {
1411+
cancelBtn.style.backgroundColor = platformColor.cancelButtonHover;
1412+
});
1413+
cancelBtn.addEventListener("mouseout", () => {
1414+
cancelBtn.style.backgroundColor = platformColor.cancelButton;
1415+
});
14021416
cancelBtn.addEventListener("click", () => {
14031417
document.body.removeChild(modal);
14041418
});

js/utils/platformstyle.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ let platformThemes = {
4040
strokeColor: "#E2E2E2",
4141
fillColor: "#F9F9F9",
4242
blueButton: "#0066FF",
43+
blueButtonHover: "#023a76",
44+
cancelButton: "#f1f1f1",
45+
cancelButtonHover: "#afafaf",
4346
hoverColor: "#808080",
4447
paletteColors: {
4548
widgets: ["#2E7D32", "#1B5E20", "#388E3C", "#81C784"],
@@ -191,6 +194,9 @@ let platformThemes = {
191194
strokeColor: "#E2E2E2",
192195
fillColor: "#F9F9F9",
193196
blueButton: "#0066FF",
197+
blueButtonHover: "#023a76",
198+
cancelButton: "#f1f1f1",
199+
cancelButtonHover: "#afafaf",
194200
hoverColor: "#E0E0E0",
195201
paletteColors: {
196202
widgets: ["#7CD622", "#57AD02", "#77C428", "#B4EB7D"],

0 commit comments

Comments
 (0)