diff --git a/docs/_static/css/coveo_custom.css b/docs/_static/css/coveo_custom.css new file mode 100644 index 00000000000..8eec37c1653 --- /dev/null +++ b/docs/_static/css/coveo_custom.css @@ -0,0 +1,45 @@ +:root { + --atomic-primary: rgb(var(--ost-color-navbar-background)); + --atomic-primary-light: rgb(var(--ost-color-sst-dropdown-background-active)); + --atomic-border-radius-md: 0.1rem; + --atomic-border-radius-lg: 0.2rem; + --atomic-border-radius-xl: 0.3rem; +} + +::part(result-list-grid-clickable-container) { + border: 1px solid lightgray; + border-radius: var(--atomic-border-radius-md); +} + +.view-selector-container { + grid-area: atomic-section-facets; + display: flex; + align-items: center; + column-gap: 0.5rem; +} + +.view-selector-container .view-selector, +.view-selector-container .view-selector:hover, +.view-selector-container .view-selector:active, +.view-selector-container .view-selector:focus { + border: none; + background-color: none; + background: none; + outline: none; + padding: 4px 12px; + font-size: 14px; + display: flex; + grid-gap: 8px; + align-items: center; + justify-content: center; +} + +.view-selector-container .view-selector i { + margin: 0; +} + +.view-selector-container .view-selector.selected { + border-bottom: 2px solid rgb(var(--ost-color-navbar-background)); + font-weight: 700; + color: rgb(var(--ost-color-navbar-background)); +} diff --git a/docs/_static/js/custom.js b/docs/_static/js/custom.js index 51f9eb605c5..a208c2c7362 100644 --- a/docs/_static/js/custom.js +++ b/docs/_static/js/custom.js @@ -281,3 +281,58 @@ function initSplide() { }); splide.mount(); } + +// ---------- COVEO SEARCH ----------- +function selectResultViewType(type, gridButton, listButton) { + type === "grid" ? gridButton.click() : listButton.click(); +} + +function addViewTypeListeners() { + const resultViewTypeFromLs = window.localStorage.getItem('atomicResultViewType'); + let list = document.getElementById("atomic-result-list"); + var viewSelectorGrid = document.getElementById("view-selector-grid"); + viewSelectorGrid.addEventListener('click', function () { + list.display = "grid"; + window.localStorage.setItem('atomicResultViewType', "grid"); + viewSelectorGrid.classList.add('selected'); + viewSelectorList.classList.remove('selected'); + selectResultViewType("grid", viewSelectorGrid, viewSelectorList); + }); + var viewSelectorList = document.getElementById("view-selector-list"); + viewSelectorList.addEventListener('click', function () { + list.display = "list"; + window.localStorage.setItem('atomicResultViewType', "list"); + viewSelectorList.classList.add('selected'); + viewSelectorGrid.classList.remove('selected'); + selectResultViewType("list", viewSelectorGrid, viewSelectorList); + }); + selectResultViewType(resultViewTypeFromLs || "grid", viewSelectorGrid, viewSelectorList); +} + +document.addEventListener('DOMContentLoaded', function () { + (async () => { + await customElements.whenDefined("atomic-search-interface"); + const searchInterfaceSa = document.querySelector("#sa-search"); + const searchInterface = document.querySelector("#search"); + if (searchInterfaceSa) { + let ver = getCurrentVersion(); + if (ver) { + searchInterfaceSa.innerHTML = searchInterfaceSa.innerHTML.replace('search.html', 'search.html#f-ovversion=' + ver); + } + await searchInterfaceSa.initialize({ + accessToken: "xx1f2aebd3-4307-4632-aeea-17c13378b237", + organizationId: "intelcorporationnonproduction2ybdyblf7", + }); + searchInterfaceSa.executeFirstSearch(); + } + if (searchInterface) { + await searchInterface.initialize({ + accessToken: "xx1f2aebd3-4307-4632-aeea-17c13378b237", + organizationId: "intelcorporationnonproduction2ybdyblf7", + }); + searchInterface.executeFirstSearch(); + } + addViewTypeListeners(); + })(); +}) +// ----------------------------------- diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html index 6793f261ca5..e85f73556dd 100644 --- a/docs/_templates/layout.html +++ b/docs/_templates/layout.html @@ -5,8 +5,12 @@ + + + + @@ -28,4 +32,3 @@ {% endblock %} - diff --git a/docs/_templates/search-field.html b/docs/_templates/search-field.html index 4ed6c3803df..f4e9d142cb4 100644 --- a/docs/_templates/search-field.html +++ b/docs/_templates/search-field.html @@ -1,4 +1,6 @@ -
+- Search Results... -
- - {% block scriptwarning %} -