From c478f45e19a52c535edb99548efb9275ee0dd8f5 Mon Sep 17 00:00:00 2001 From: Rikin Kachhia Date: Thu, 13 Dec 2018 16:38:45 +0530 Subject: [PATCH] migrate docs search to algolia doc search (close #1146) (#1199) --- docs/_static/hasura-custom.css | 96 ++++++-------- docs/_theme/djangodocs/layout.html | 195 ++--------------------------- 2 files changed, 50 insertions(+), 241 deletions(-) diff --git a/docs/_static/hasura-custom.css b/docs/_static/hasura-custom.css index 425990769f9..e32cf4a4ea3 100644 --- a/docs/_static/hasura-custom.css +++ b/docs/_static/hasura-custom.css @@ -80,60 +80,6 @@ h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visit /* End of Loader */ -/* Search links */ - -.algolia_search_attribution { - font-size: 18px; - margin-top: 10px; - text-align: left; -} - -.algolia_search_attribution .algolia_image { - vertical-align: middle; - width: 70px; -} - -.no_of_results { - display: inline; - color: #CF9C0E; - font-weight: 600; -} - -.no_results { - text-align: left; -} - -.search_query { - color: #CF9C0E; - font-weight: 600 -} - -.search_results_anchor { - text-decoration-color: #CF9C0E; -} - -.search_results_description { - width: 60%; -} - -.search_wrapper { - min-height: 76vh; -} - -.search_bullets::before { - color: #788095; -} - -.search_bullets { - list-style-type: disc; - text-align: left; -} - -.search_heading { - color: #788095; -} - -/* End of Search */ .hide { display: none !important; @@ -613,13 +559,39 @@ p { width: 64%; } -.search_icon { +.input_search_box .search_icon { position: absolute; top: 13px; left: 10px; font-size: 18px; color: #FEC53D; cursor: pointer; + z-index: 1; +} + +.input_search_box .algolia-autocomplete { + width: 100%; +} + +.input_search_box .algolia-autocomplete.algolia-autocomplete-left .ds-dropdown-menu, +.input_search_box .algolia-autocomplete.algolia-autocomplete-right .ds-dropdown-menu { + left: -25px !important; + max-width: calc(156% + 50px); + min-width: calc(156% + 50px); /* 1 / width(input_search_box) + 50px */ +} + +.input_search_box .algolia-autocomplete a { + text-decoration: none; +} + +.input_search_box .algolia-autocomplete .algolia-docsearch-suggestion--highlight { + color: #FF993A; +} + +.input_search_box .algolia-autocomplete .algolia-docsearch-suggestion--category-header .algolia-docsearch-suggestion--category-header-lvl0 .algolia-docsearch-suggestion--highlight, +.input_search_box .algolia-autocomplete .algolia-docsearch-suggestion--category-header .algolia-docsearch-suggestion--category-header-lvl1 .algolia-docsearch-suggestion--highlight, +.input_search_box .algolia-autocomplete .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight { + box-shadow: inset 0 -2px 0 0 #FF993A; } .input_search_box input { @@ -1369,6 +1341,13 @@ ol, ul { margin-left: 10px; } + .input_search_box .algolia-autocomplete.algolia-autocomplete-left .ds-dropdown-menu, + .input_search_box .algolia-autocomplete.algolia-autocomplete-right .ds-dropdown-menu { + left: -34px !important; + max-width: calc(166% + 10px); + min-width: calc(166% + 10px); /* 1 / width(input_search_box) + 10px */ + } + .mobile-only { display: initial; } @@ -1425,6 +1404,13 @@ ol, ul { margin-left: 10px; } + .input_search_box .algolia-autocomplete.algolia-autocomplete-right .ds-dropdown-menu, + .input_search_box .algolia-autocomplete.algolia-autocomplete-left .ds-dropdown-menu { + left: -34px !important; + max-width: calc(111% + 10px); + min-width: calc(111% + 10px); /* 1 / width(input_search_box) + 10px */ + } + #sidebar { top: 170px; height: calc(100% - 170px); diff --git a/docs/_theme/djangodocs/layout.html b/docs/_theme/djangodocs/layout.html index 8b84788d749..8aecfef6958 100644 --- a/docs/_theme/djangodocs/layout.html +++ b/docs/_theme/djangodocs/layout.html @@ -16,6 +16,7 @@ + {% endblock %} {% block document %} @@ -146,75 +147,6 @@ {%- endif %} -
-
-

-
- <%= totalResults %> result<%= totalResults > 1 ? 's' : '' %> for '<%= _.escape(searchString) %>' -
-
- - powered by - - - Algolia Hasura Search - -
-

-
- <% - if ( objs.length > 0 ) { - %> - - <% - } else { - %> -
Sorry! we cannot find what you are searching for!
- <% - } - %> -
-
-
-
-
-
- - -
-
-
-
-
{% endblock %} @@ -333,124 +265,15 @@ + + docsearch({ + apiKey: 'c59018461c19e20fe11459136e57900c', + indexName: 'hasura', + inputSelector: '.search_element', + debug: false + }); +