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 @@