From f694b0dd313818e3ef34a9299bb9df3b67e3740e Mon Sep 17 00:00:00 2001 From: Ian Maddaus Date: Thu, 7 Nov 2024 17:01:15 -0500 Subject: [PATCH] Update theme Signed-off-by: Ian Maddaus --- .../assets/js/swiftype-config.js | 36 ++++- .../assets/sass/partials/_sidebar.scss | 3 + .../sass/partials/_swiftype_search.scss | 150 +++++++----------- .../layouts/_default/search.html | 13 +- .../layouts/partials/range_menu.html | 2 +- .../layouts/partials/sidebar-off-canvas.html | 26 +-- .../partials/swiftype_search_modal.html | 5 +- .../layouts/partials/utility-bar.html | 2 +- _vendor/modules.txt | 2 +- go.mod | 2 +- go.sum | 6 +- 11 files changed, 126 insertions(+), 121 deletions(-) diff --git a/_vendor/github.com/chef/chef-docs-theme/assets/js/swiftype-config.js b/_vendor/github.com/chef/chef-docs-theme/assets/js/swiftype-config.js index 0342ae185de..77e833275b6 100644 --- a/_vendor/github.com/chef/chef-docs-theme/assets/js/swiftype-config.js +++ b/_vendor/github.com/chef/chef-docs-theme/assets/js/swiftype-config.js @@ -89,12 +89,37 @@ $(document).ready(function() { history.pushState({page: "Chef Documentation Search"}, "", "/search/") }); - $("input#swiftype-search-top-container-form-input-search").on('click', function (event) { - console.log('search') + $("input#swiftype-search-top-container-form-input-search").on('click', function() { const searchString = $('input#swiftype-search-top-container-form-input').val(); window.location.href = "/search/#stq=" + encodeURIComponent(searchString) + '&stp=1'; }); + // trigger hideCustomFacets function after resize ends + var debounce = function(fn, interval) { + let timer; + return function debounced(...args) { + clearTimeout(timer); + timer = setTimeout(function call() { + fn(...args); + }, interval); + }; + } + + // show and hide elements when resizing + var hideCustomFacets = function() { + if ($(this).width() > 768) { + $('#swiftype-custom-facet-products').show(); + $("#search-facet-product-toggle-caret > svg.fa-caret-down").hide(); + $("#search-facet-product-toggle-caret > svg.fa-caret-up").hide(); + } else { + $('#swiftype-custom-facet-products').hide(); + $("#search-facet-product-toggle-caret > svg.fa-caret-down").hide(); + $("#search-facet-product-toggle-caret > svg.fa-caret-up").show(); + } + } + + $(window).resize(debounce(hideCustomFacets, 400)); + /////////////////////////////////// // // Search Filter functions @@ -177,6 +202,12 @@ $(document).ready(function() { processLocationHash(); }; + $("#search-facet-product").click(function() { + if ($(window).width() < 860) { + $("#swiftype-custom-facet-products").toggle(500); + $("#search-facet-product-toggle-caret").find('svg').toggle(); + } + }); ///////////////////////// // Handle Search Results @@ -223,7 +254,6 @@ $(document).ready(function() { const getChefProducts = function(){ if ($('#swiftype-product-filters :checkbox:checked').length === 0) { searchConfig.facets['chef-products'] = parsedDefaultSearchProducts; - console.log('none checked', $(this)); } else { searchConfig.facets['chef-products'] = $("#swiftype-custom-facets input:checkbox[name='chef-product']:checked, select.search-facet-versions:visible option:selected").map(function() { return $(this).val() diff --git a/_vendor/github.com/chef/chef-docs-theme/assets/sass/partials/_sidebar.scss b/_vendor/github.com/chef/chef-docs-theme/assets/sass/partials/_sidebar.scss index aa5f74b0ac1..f24cec29ebf 100644 --- a/_vendor/github.com/chef/chef-docs-theme/assets/sass/partials/_sidebar.scss +++ b/_vendor/github.com/chef/chef-docs-theme/assets/sass/partials/_sidebar.scss @@ -21,6 +21,9 @@ color:$orange-lighter; } } + #top-bar-close { + height: 25px; + } } .sidebar { diff --git a/_vendor/github.com/chef/chef-docs-theme/assets/sass/partials/_swiftype_search.scss b/_vendor/github.com/chef/chef-docs-theme/assets/sass/partials/_swiftype_search.scss index 88b96162271..571e1a82589 100644 --- a/_vendor/github.com/chef/chef-docs-theme/assets/sass/partials/_swiftype_search.scss +++ b/_vendor/github.com/chef/chef-docs-theme/assets/sass/partials/_swiftype_search.scss @@ -2,22 +2,52 @@ display: none; background-color: #fefefe; left: 50%; - top: 100px; + top: 90px; position: absolute; transform: translate(-50%, -50%); z-index: 1000; - width: 60%; + box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); padding: 10px; font-size: 1rem; + @media (max-width: map-get($breakpoints, medium)) { + width: 100%; + } + + @media not (max-width: map-get($breakpoints, medium)) { + width: 60%; + } + &-content { display: flex; - align-items: flex-start; + align-items: center; font-size: 1rem; + flex-direction: row; + + #swiftype-search-form-modal { + flex: 1; + flex-shrink: 1; + } + + #swiftype-search-close { + + flex: 0; + position: relative; + top: -15px; + + &-button { + display: inline; + vertical-align: text-top; + font-size: 1.5rem; + margin: 0 .5rem 0 .75rem; + margin-bottom: auto; + } + } .input-group { margin: 1rem; + min-width: 10px; } input { @@ -36,17 +66,10 @@ margin-right: 5px; } - #swiftype-search-close-button { - display: inline; - vertical-align: text-top; - font-size: 1.5rem; - margin: 0 .5rem 0 .75rem; - } - } } -#swiftype-lower-container{ +#swiftype-lower-container { overflow-y: hidden; padding-bottom: 10px; display: flex; @@ -85,7 +108,8 @@ padding: 20px 0; select { - width: 150px; + width: 100%; + max-width: 120px; border: 1px solid $border-dark; height: 2rem; border-radius: $border-radius-base; @@ -100,39 +124,17 @@ #swiftype-version-filters { border-bottom: 1px solid $border-dark; padding: 20px 0; - } - - .search-facet-versions { display: none; - margin: 0 0 1rem 1rem; - } - span#swiftype-custom-facets-toggle-caret{ - color: $accordionmenu-arrow-color; - margin-left: .5rem; - } - - #swiftype-custom-facets{ - >ul{ - margin: 1em 0; - ul{ - margin-left: 1em; - } - } - ul { - list-style-type: none; - input { - margin-bottom: .75em; - } - } - #swiftype-version-filters { + .swiftype-product-versions { display: none; - - .swiftype-product-versions { - display: none; - } } } + + .search-facet-versions { + display: none; + margin: 0 0 1rem 1.5rem; + } } #swiftype-results-container{ @@ -168,6 +170,13 @@ >span { display: inherit; overflow: hidden; + + &.st-result-detail-body, &.st-result-sections { + @media (max-width: map-get($breakpoints, medium)) { + display: none; + } + } + &.st-result-title { font-size: 1.25rem; font-weight: 500; @@ -217,24 +226,6 @@ } } -@media (max-width: 768px) { - #swiftype-modal-content { - width: 100%; - height: 100%; - } - .st-result-detail-body { - display: none; - } - #swiftype-lower-container { - #swiftype-modal-content-container { - flex-direction: column; - } - } - #swiftype-custom-facets { - display: none; - } -} - /////// // Swiftype Search /////// @@ -277,42 +268,13 @@ } } } -} - - - -form > input.swiftype-search { - - &-form { - width: 80%; - } - - &-autocomplete { - margin: 5px 0; - display: inline-block; - height: 2.5em; - } -} - -#swiftype-modal-search-form { - form > #swiftype-search-form-modal { - width: 100%; - margin-right: 10px; - box-sizing: border-box; - height: 32px; - } - - - #swiftype-search-close-button { - font-size: .9rem; - margin-left: 10px; - padding: 6px; - border: 1px solid $border-dark; - border-radius: $border-radius-base; - - &:hover { - color: $white; - background-color: $body-font-color; + #swiftype-lower-container { + #swiftype-custom-facets{ + .swiftype-custom-facet-content { + @media (max-width: map-get($breakpoints, mediumlarge)) { + display: none; + } + } } } } diff --git a/_vendor/github.com/chef/chef-docs-theme/layouts/_default/search.html b/_vendor/github.com/chef/chef-docs-theme/layouts/_default/search.html index 25d53d2339e..df9a9766339 100644 --- a/_vendor/github.com/chef/chef-docs-theme/layouts/_default/search.html +++ b/_vendor/github.com/chef/chef-docs-theme/layouts/_default/search.html @@ -6,7 +6,7 @@
- +
@@ -21,7 +21,7 @@
-
+
Filters
@@ -30,8 +30,14 @@
- Products + Products + + + + + +
{{- range .Site.Params.search.products -}} {{ $productKey := .product_key | anchorize }} {{ $productSearchKey := .product_key }} @@ -63,6 +69,7 @@ {{ end }} {{- end -}} +
diff --git a/_vendor/github.com/chef/chef-docs-theme/layouts/partials/range_menu.html b/_vendor/github.com/chef/chef-docs-theme/layouts/partials/range_menu.html index 58e1194bf40..fb3ab10d18f 100644 --- a/_vendor/github.com/chef/chef-docs-theme/layouts/partials/range_menu.html +++ b/_vendor/github.com/chef/chef-docs-theme/layouts/partials/range_menu.html @@ -64,4 +64,4 @@ {{ end }} {{ end }} -{{ end }} \ No newline at end of file +{{ end }} diff --git a/_vendor/github.com/chef/chef-docs-theme/layouts/partials/sidebar-off-canvas.html b/_vendor/github.com/chef/chef-docs-theme/layouts/partials/sidebar-off-canvas.html index 5a5cdff1d23..5e3848d301b 100644 --- a/_vendor/github.com/chef/chef-docs-theme/layouts/partials/sidebar-off-canvas.html +++ b/_vendor/github.com/chef/chef-docs-theme/layouts/partials/sidebar-off-canvas.html @@ -1,35 +1,41 @@ -{{ if ne (.Param "left_nav") false }}
-{{ end }} \ No newline at end of file diff --git a/_vendor/github.com/chef/chef-docs-theme/layouts/partials/swiftype_search_modal.html b/_vendor/github.com/chef/chef-docs-theme/layouts/partials/swiftype_search_modal.html index acaef20a4f6..d2ffea390ba 100644 --- a/_vendor/github.com/chef/chef-docs-theme/layouts/partials/swiftype_search_modal.html +++ b/_vendor/github.com/chef/chef-docs-theme/layouts/partials/swiftype_search_modal.html @@ -2,7 +2,7 @@
- +
@@ -11,12 +11,11 @@
-
+
-
diff --git a/_vendor/github.com/chef/chef-docs-theme/layouts/partials/utility-bar.html b/_vendor/github.com/chef/chef-docs-theme/layouts/partials/utility-bar.html index dede59d0a38..0f8b5bbe26d 100644 --- a/_vendor/github.com/chef/chef-docs-theme/layouts/partials/utility-bar.html +++ b/_vendor/github.com/chef/chef-docs-theme/layouts/partials/utility-bar.html @@ -20,7 +20,7 @@ {{- end -}} - diff --git a/_vendor/modules.txt b/_vendor/modules.txt index 17d43744876..cda44dde7c1 100644 --- a/_vendor/modules.txt +++ b/_vendor/modules.txt @@ -14,7 +14,7 @@ # github.com/chef/compliance-profiles/docs-chef-io v0.0.0-20241024083927-f5e6fa3425ae # github.com/chef/compliance-remediation-2022/docs-chef-io v0.0.0-20240313054833-ebbc45209efa # github.com/chef/license-service/docs-chef-io v0.0.0-20231117105514-d3f3d53ba2dd -# github.com/chef/chef-docs-theme v0.0.0-20241105194622-6f1c72e4b261 +# github.com/chef/chef-docs-theme v0.0.0-20241107225806-d12cfd63de6f # github.com/FortAwesome/Font-Awesome v0.0.0-20240108205627-a1232e345536 # github.com/cowboy/jquery-hashchange v0.0.0-20100902193700-0310f3847f90 # github.com/twitter/hogan.js v3.0.2+incompatible diff --git a/go.mod b/go.mod index 57ed10ffc24..ffb573e2b07 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.22 require ( github.com/chef/automate/components/docs-chef-io v0.0.0-20240926130942-4b98d9cf92f6 // indirect - github.com/chef/chef-docs-theme v0.0.0-20241105194622-6f1c72e4b261 // indirect + github.com/chef/chef-docs-theme v0.0.0-20241107225806-d12cfd63de6f // indirect github.com/chef/chef-server/docs-chef-io v0.0.0-20240920053744-03b58ff14f46 // indirect github.com/chef/chef-workstation/docs-chef-io v0.0.0-20240809064339-878cb76b2b66 // indirect github.com/chef/compliance-profiles/docs-chef-io v0.0.0-20241024083927-f5e6fa3425ae // indirect diff --git a/go.sum b/go.sum index d5a4d7ba596..bff6e8a33eb 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,7 @@ github.com/chef/automate/components/docs-chef-io v0.0.0-20240926130942-4b98d9cf92f6 h1:scrWEAK18Peqbtc3CxwxVaFp595kr+r8eYvYxW7qjQU= github.com/chef/automate/components/docs-chef-io v0.0.0-20240926130942-4b98d9cf92f6/go.mod h1:juvLC7Rt33YOCgJ5nnfl4rWZRAbSwqjTbWmcAoA0LtU= -github.com/chef/chef-docs-theme v0.0.0-20241031214229-5b4650244dc6 h1:yD8dEXVzfVrMwVOMJ1xWLAkOM6ktKI1VF54xF7y8vmo= -github.com/chef/chef-docs-theme v0.0.0-20241031214229-5b4650244dc6/go.mod h1:+Jpnv+LXE6dXu2xDcMzMc0RxRGuCPAoFxq5tJ/X6QpQ= -github.com/chef/chef-docs-theme v0.0.0-20241105194622-6f1c72e4b261 h1:eb/iH1PzF+N231g2yZLMdbaELJBaNu//ner27h525hE= -github.com/chef/chef-docs-theme v0.0.0-20241105194622-6f1c72e4b261/go.mod h1:+Jpnv+LXE6dXu2xDcMzMc0RxRGuCPAoFxq5tJ/X6QpQ= +github.com/chef/chef-docs-theme v0.0.0-20241107225806-d12cfd63de6f h1:Foce2Bysziy4UPu+EOnsNiWVR15HG/18QdNTsdxZYPM= +github.com/chef/chef-docs-theme v0.0.0-20241107225806-d12cfd63de6f/go.mod h1:+Jpnv+LXE6dXu2xDcMzMc0RxRGuCPAoFxq5tJ/X6QpQ= github.com/chef/chef-server/docs-chef-io v0.0.0-20240920053744-03b58ff14f46 h1:KKSufg3MDKPPzXN2Nv6vUGhx8LIYmYMo9ByQMFbj8Rk= github.com/chef/chef-server/docs-chef-io v0.0.0-20240920053744-03b58ff14f46/go.mod h1:gMSa25GUHmLimA0gjvRd3hs1buOBqkKPrdHzHvaJauY= github.com/chef/chef-workstation/docs-chef-io v0.0.0-20240809064339-878cb76b2b66 h1:mGSa2uVyyi8bHyluwmmd83UReZR9gqF/roi5v7lnv0s=