Skip to content

Commit edea62b

Browse files
committed
feat: Removed unneeded JS + moved to CSS
1 parent 33e2e9f commit edea62b

File tree

2 files changed

+24
-25
lines changed

2 files changed

+24
-25
lines changed

assets/css/v2/style.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,30 @@ atomic-search-layout atomic-layout-section[section="search"] {
505505
z-index: 9999;
506506
}
507507

508+
header atomic-search-interface {
509+
/* Hide by default */
510+
display: none;
511+
}
512+
513+
body:not(:has(.main-layout)) header atomic-search-interface {
514+
/* Show on landing pages */
515+
display: block;
516+
}
517+
518+
@media (max-width: 1184px) {
519+
/* Show on pages with sidebar if it is hidden */
520+
body:has(.sidebar-layout) header atomic-search-interface {
521+
display: block;
522+
}
523+
}
524+
525+
@media (max-width: 1023px) {
526+
/* Show on search page with facet if it is hidden */
527+
body:has(atomic-search-layout) header atomic-search-interface {
528+
display: block;
529+
}
530+
}
531+
508532
/* Sidebar */
509533
.sidebar {
510534
display: flex;

assets/js/coveo.js

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ async function atomicCoveo() {
8585
},
8686
});
8787

88-
searchBarHeader.style.display =
89-
sidebar || searchPageInterface ? 'none' : 'block';
9088
await searchBarHeader.executeFirstSearch();
9189
}
9290

@@ -158,26 +156,3 @@ document.addEventListener('DOMContentLoaded', async () => {
158156
legacyCoveo();
159157
}
160158
});
161-
162-
window.addEventListener('resize', (event) => {
163-
const searchBarHeader = document.querySelector('#search-standalone-header');
164-
const searchPageInterface = document.querySelector('#search-v2');
165-
const searchPageSearchbar = document.querySelector(
166-
'#search-standalone-searchpage'
167-
);
168-
const sidebar = document.querySelector('#sidebar-layout');
169-
170-
if (!sidebar && !searchPageInterface) {
171-
// Show when there is no sidebar or on the search page
172-
searchBarHeader.style.display = 'block';
173-
} else if (sidebar && sidebar.offsetWidth === 0) {
174-
// Show when there is a sidebar but is hidden due to resizing
175-
searchBarHeader.style.display = 'block';
176-
} else if (searchPageInterface && searchPageSearchbar.offsetWidth === 0) {
177-
// Show when on the search page but is "sidebar" searchbar is hidden
178-
searchBarHeader.style.display = 'block';
179-
} else {
180-
// Go back to default state
181-
searchBarHeader.style.display = 'none';
182-
}
183-
});

0 commit comments

Comments
 (0)