Skip to content

Commit 8ebe319

Browse files
Added dark mode feature in searchbar, helpfulsearch and search results (sugarlabs#4333)
* Added dark mode feature in searchbar, helpfulsearch and search results * Added dark mode feature in searchbar, helpfulsearch and search results --------- Co-authored-by: Walter Bender <[email protected]>
1 parent 1cca647 commit 8ebe319

File tree

3 files changed

+48
-15
lines changed

3 files changed

+48
-15
lines changed

css/activities.css

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@
1616
outline: none;
1717
}
1818

19+
body:not(.dark-mode) #helpfulSearch,
20+
body:not(.dark-mode) .ui-autocomplete {
21+
background-color: #fff !important;
22+
color: #000 !important;
23+
}
24+
25+
body:not(.dark-mode) .ui-autocomplete li:hover {
26+
background-color: #ddd !important;
27+
}
28+
29+
body:not(.dark-mode) #helpfulSearchDiv {
30+
background-color: #f9f9f9 !important;
31+
}
32+
1933
.modal {
2034
display: none;
2135
position: fixed;
@@ -92,7 +106,7 @@
92106
display: block !important;
93107
position: absolute;
94108
background-color: #f0f0f0;
95-
padding: 5px;
109+
padding: 2px;
96110
border: 1px solid #ccc;
97111
width: 230px;
98112
z-index: 1;
@@ -106,6 +120,17 @@
106120
font-size: large;
107121
}
108122

123+
#crossButton {
124+
position: absolute;
125+
top: 50%;
126+
right: -30px;
127+
transform: translateY(-50%);
128+
background: transparent;
129+
border: none;
130+
font-size: large;
131+
cursor: pointer;
132+
}
133+
109134
.trash-view {
110135
position: relative;
111136
background-color: white;

css/darkmode.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,20 @@
6262
.dark-mode #submitLilypond {
6363
background-color: rgb(0, 102, 255);
6464
}
65+
66+
.dark-mode #search, #helpfulSearch, .ui-autocomplete{
67+
background-color: #1c1c1c;
68+
color: #fff;
69+
}
70+
71+
.dark-mode .ui-autocomplete li:hover{
72+
background-color: #225a91;
73+
}
74+
75+
.dark-mode #helpfulSearchDiv{
76+
background-color: transparent;
77+
}
78+
79+
.dark-mode #crossButton{
80+
color: #fff;
81+
}

js/activity.js

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -443,27 +443,18 @@ class Activity {
443443
const closeButtonDiv = document.createElement("div");
444444
closeButtonDiv.style.cssText =
445445
"position: absolute;" +
446-
"top: 10px;" + // Adjust the top position to center it vertically
447-
"right: 10px;" + // Position the button on the right side of the helpfulSearchDiv
446+
"top: 10px;" +
447+
"right: 10px;" +
448448
"cursor: pointer;";
449449

450450
// Create the cross button itself
451451
const closeButton = document.createElement("button");
452-
closeButton.textContent = "×"; // You can use HTML entity or an icon
453-
closeButton.style.cssText =
454-
"position: absolute;" +
455-
"top: 50%;" + // Center vertically
456-
"right: -30px;" + // Place it outside the input, adjust as needed
457-
"transform: translateY(-50%);" + // Align with vertical center of input
458-
"background: transparent;" +
459-
"border: none;" +
460-
"font-size: large;" +
461-
"cursor: pointer;";
452+
closeButton.textContent = "×";
453+
closeButton.id = "crossButton";
454+
document.body.appendChild(closeButton);
462455

463-
// Append the cross button to the closeButtonDiv
464456
closeButtonDiv.appendChild(closeButton);
465457

466-
// Append the closeButtonDiv to the helpfulSearchDiv
467458
this.helpfulSearchDiv.appendChild(closeButtonDiv);
468459

469460
// Add event listener to remove the search div from the DOM

0 commit comments

Comments
 (0)