Skip to content

Commit b2701ab

Browse files
committed
Coveo: Remove JS solution + small refactor of code
1 parent 0275540 commit b2701ab

File tree

2 files changed

+29
-46
lines changed

2 files changed

+29
-46
lines changed

assets/css/v2/style.css

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -643,31 +643,6 @@ ol li:last-child {
643643
border-top: 1px solid oklch(var(--color-divider));
644644
}
645645

646-
/* Coveo toggling */
647-
#search-standalone-header-panel:checked ~ .grid-container {
648-
& :has([data-mode="mobile"]) {
649-
.header__search[data-mode="mobile"] {
650-
position: absolute;
651-
top: 100%;
652-
width: 100%;
653-
padding-top: 0;
654-
655-
#search-standalone-header {
656-
display: unset;
657-
658-
atomic-search-box {
659-
width: calc(100% + 2rem);
660-
margin-left: -1rem;
661-
}
662-
}
663-
}
664-
665-
.header + * {
666-
margin-top: 2rem;
667-
}
668-
}
669-
}
670-
671646
/* sidebar toggling */
672647
#sidebar-panel:checked ~ .grid-container {
673648
grid-template-columns: 1fr;
@@ -841,6 +816,27 @@ ol li:last-child {
841816

842817
/* This is our "mobile" or no sidebar breakpoint */
843818
@media (max-width: 68rem) {
819+
#search-standalone-header-panel:checked ~ .grid-container {
820+
.header__search[data-mode="mobile"] {
821+
position: absolute;
822+
top: 100%;
823+
width: 100%;
824+
padding-top: 0;
825+
826+
#search-standalone-header {
827+
display: unset;
828+
829+
atomic-search-box {
830+
width: calc(100% + 2rem);
831+
margin-left: -1rem;
832+
}
833+
}
834+
}
835+
836+
.header + * {
837+
margin-top: 2rem;
838+
}
839+
}
844840
#sidebar-panel:not(:checked) ~ .grid-container {
845841
.header {
846842
.header__control--sidebar--close {
@@ -913,6 +909,14 @@ ol li:last-child {
913909
}
914910
}
915911

912+
.grid-container:has(.homepage) {
913+
.header {
914+
.header__search--mobile--search--button {
915+
display: block;
916+
}
917+
}
918+
}
919+
916920
.header {
917921
.product-selector {
918922
display: none;
@@ -929,10 +933,6 @@ ol li:last-child {
929933
}
930934
}
931935
.header-container {
932-
.header__search--mobile--search--button {
933-
display: block;
934-
}
935-
936936
.header__search {
937937
#search-standalone-header {
938938
display: none;

assets/js/coveo.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -103,20 +103,3 @@ async function atomicCoveo() {
103103
document.addEventListener('DOMContentLoaded', async () => {
104104
atomicCoveo();
105105
});
106-
107-
window.addEventListener('resize', () => {
108-
const MODES = [
109-
// my really bad enum
110-
'desktop',
111-
'mobile',
112-
];
113-
const search = document.getElementById('header__search');
114-
115-
if (search) {
116-
if (window.innerWidth < 68 * 16) {
117-
search.setAttribute('data-mode', MODES[1]);
118-
} else {
119-
search.setAttribute('data-mode', MODES[0]);
120-
}
121-
}
122-
});

0 commit comments

Comments
 (0)