Skip to content

Commit 97fdb6e

Browse files
committed
Experimenting with gradients
1 parent 0d715b8 commit 97fdb6e

File tree

2 files changed

+41
-30
lines changed

2 files changed

+41
-30
lines changed

src/components/sidebar/sidebar.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const searchInput = document.getElementById("search-input");
77
const tabList = document.getElementById("tab-list");
88
const newTabButton = document.getElementById("new-tab-button");
99
const spaceName = document.querySelector('input#space-name');
10+
const favoriteDiv = document.querySelector('#favorites')
1011

1112
// Add event listeners
1213
newTabButton.addEventListener("click", () =>
@@ -370,9 +371,9 @@ function favoriteDrop() {
370371
})
371372
}
372373

373-
document.querySelector('#favorites').addEventListener('dragenter', favoriteDragOver);
374-
document.querySelector('#favorites').addEventListener('dragover', favoriteDragOver);
375-
document.querySelector('#favorites').addEventListener('drop', favoriteDrop);
374+
favoriteDiv.addEventListener('dragenter', favoriteDragOver);
375+
favoriteDiv.addEventListener('dragover', favoriteDragOver);
376+
favoriteDiv.addEventListener('drop', favoriteDrop);
376377

377378
function loadFavorites() {
378379
// Render
@@ -399,25 +400,21 @@ function loadFavorites() {
399400
updateSearchBar();
400401
}
401402
element.onauxclick = async (event) => {
402-
if (event.button === 1 && openedFavorites[favorite.id]) {
403+
if (event.button == 1 && openedFavorites[favorite.id]) {
403404
// Unload favorite
404405
browser.tabs.remove(openedFavorites[favorite.id])
405406
openedFavorites[favorite.id] = undefined
406407
element.ariaLabel = ""
407-
} else if (event.button === 2) {
408+
} else if (event.button == 2) {
408409
// Remove favorite
410+
initTabSidebarControl();
409411
if (openedFavorites[favorite.id]) {
410-
if (element.ariaLabel === "favopen") {
411-
initTabSidebarControl();
412-
} else {
413-
browser.tabs.remove(openedFavorites[favorite.id]);
414-
}
415412
delete openedFavorites[favorite.id];
416413
}
417414
browser.storage.local.get('favorites', function (result) {
418415
var favoritesg = result.favorites;
419416
delete favoritesg[favorite.id]
420-
document.querySelector('#favorites').innerHTML = "";
417+
favoriteDiv.innerHTML = "";
421418
favorites = favoritesg
422419
loadFavorites();
423420
browser.storage.local.set({
@@ -432,7 +429,7 @@ function loadFavorites() {
432429
favIcon.src = favorite.favicon;
433430
element.appendChild(favIcon)
434431

435-
document.querySelector('#favorites').appendChild(element);
432+
favoriteDiv.appendChild(element);
436433
}
437434
});
438435
}
@@ -444,7 +441,7 @@ browser.storage.onChanged.addListener(() => {
444441
if (JSON.stringify(favoritesg) !== JSON.stringify(favorites)) {
445442
favoritesg.forEach(fav => {
446443
if (fav?.url !== favorites[fav.id]?.url) {
447-
document.querySelector('#favorites').innerHTML = "";
444+
favoriteDiv.innerHTML = "";
448445
favorites = favoritesg
449446
loadFavorites();
450447
}

src/components/sidebar/style.css

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
}
77

88
:root {
9-
--outlineColor: #aac2d32f;
10-
--sidebarBackground: #3b3f52;
9+
--outlineColor: #d0d0d02f;
10+
--sidebarBackground: linear-gradient(#3d5952, #4c4a3e);
11+
--sidebarFooterBackground: linear-gradient(#513d59, 0%, #4c4a3e);
12+
--themeColorLight: #d7fff2df;
1113
}
1214

1315
@font-face {
@@ -30,7 +32,7 @@ body {
3032
position: fixed;
3133
top: 0;
3234
bottom: 0;
33-
background-color: var(--sidebarBackground);
35+
background: var(--sidebarBackground);
3436
box-shadow: 2px 0 4px rgba(0, 0, 0, 0.3);
3537
padding-left: 2px;
3638
padding-bottom: 48px;
@@ -61,6 +63,9 @@ body {
6163
#sidebar-header button i {
6264
font-size: 15px;
6365
color: #aac2d3;
66+
color: var(--themeColorLight);
67+
filter: grayscale(0.2);
68+
opacity: 0.8;
6469
}
6570

6671
#sidebar-header button i:hover {
@@ -90,7 +95,7 @@ body {
9095
padding: 15px;
9196
width: 100%;
9297
border-radius: 15px;
93-
background: #323446;
98+
background: #00000038;
9499
margin-right: -3px;
95100
transition: scale 0.1s;
96101
}
@@ -167,11 +172,11 @@ body {
167172
}
168173

169174
#sidebar-content ul li:hover {
170-
background: #323446;
175+
background: #00000024;
171176
}
172177

173178
#sidebar-content ul li.active {
174-
background-color: #5e5f71c1;
179+
background-color: #ffffff1f;
175180
}
176181

177182
#sidebar-content ul li[data-pinned="true"] {
@@ -183,7 +188,7 @@ body {
183188
}
184189

185190
#sidebar-content ul li.active:hover {
186-
background-color: #5e5f71;
191+
background-color: #ffffff2c;
187192
}
188193

189194
#sidebar-content button#new-tab-button {
@@ -195,14 +200,20 @@ body {
195200
background-color: transparent;
196201
margin-top: 10px;
197202
width: 100%;
198-
color: #aac2d3;
203+
color: var(--themeColorLight);
204+
filter: grayscale(0.5);
205+
transition: scale 0.2s;
199206
}
200207

201208
#sidebar-content button#new-tab-button:hover {
202-
background-color: #5e5f71;
209+
background-color: #ffffff21;
203210
color: white;
204211
}
205212

213+
#sidebar-content button#new-tab-button:active {
214+
scale: 0.97;
215+
}
216+
206217
#sidebar-content button#new-tab-button span {
207218
opacity: 0;
208219
position: relative;
@@ -244,7 +255,9 @@ div#space-info input {
244255
margin-left: 4px;
245256
font-size: 14px;
246257
font-weight: 600;
247-
color: #9aaec0;
258+
color: var(--themeColorLight);
259+
filter: grayscale(0.5);
260+
opacity: 0.8;
248261
}
249262

250263
.footer {
@@ -256,7 +269,7 @@ div#space-info input {
256269
bottom: 0;
257270
left: 0;
258271
right: 0;
259-
background-color: var(--sidebarBackground);
272+
background: var(--sidebarFooterBackground);
260273
padding: 18px;
261274
z-index: 1;
262275
}
@@ -268,7 +281,7 @@ div#space-info input {
268281
left: 50%;
269282
width: 90%;
270283
height: 1px;
271-
background-color: var(--outlineColor);
284+
background: var(--outlineColor);
272285
transform: translateX(-50%);
273286
}
274287

@@ -291,7 +304,8 @@ div#space-info input {
291304
z-index: 2; /* set to a higher value than the footer */
292305
width: 90%;
293306
padding: 10px;
294-
background-color: #323446;
307+
background-color: #0000003c;
308+
backdrop-filter: blur(16px);
295309
border: none;
296310
border-radius: 10px;
297311
color: white;
@@ -355,7 +369,7 @@ div#favorites:empty:-moz-drag-over::after {
355369
content: "Quickly access your most viewed websites by dragging them here";
356370
}
357371
button.favorite {
358-
background: #aac2d320 !important;
372+
background: #d1d1d120 !important;
359373
border-radius: 10px !important;
360374
height: 45px;
361375
width: 100%;
@@ -368,15 +382,15 @@ button.favorite {
368382
}
369383

370384
button.favorite:hover {
371-
background: #aac2d32d !important;
385+
background: #c0c0c02d !important;
372386
}
373387

374388
button.favorite:active {
375389
scale: 0.97;
376390
}
377391

378392
button.favorite[aria-label="favopen"] {
379-
background: #aac2d343 !important;
393+
background: #c7c7c743 !important;
380394
}
381395

382396
button.favorite img {
@@ -387,7 +401,7 @@ button.favorite img {
387401
}
388402

389403
a {
390-
color: #c9cae6 !important;
404+
color: var(--themeColorLight) !important;
391405
}
392406

393407
@keyframes divspawn {

0 commit comments

Comments
 (0)