You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by bl...@apache.org on 2022/06/07 15:22:04 UTC

[iceberg-docs] branch main updated: Move search bar to the top of the page (#74)

This is an automated email from the ASF dual-hosted git repository.

blue pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-docs.git


The following commit(s) were added to refs/heads/main by this push:
     new 77d0210  Move search bar to the top of the page (#74)
77d0210 is described below

commit 77d02101cd322e6033ab42fd29af17b4d04d6c30
Author: kyle-cx <24...@qq.com>
AuthorDate: Tue Jun 7 23:21:59 2022 +0800

    Move search bar to the top of the page (#74)
    
    Co-authored-by: samredai <43...@users.noreply.github.com>
---
 docs/assets/_custom.scss                           | 22 +++++++++++++++++++---
 docs/assets/search.js                              |  2 +-
 .../hugo-book => }/layouts/_default/baseof.html    | 10 ++++++++++
 docs/layouts/partials/docs/search.html             |  2 --
 docs/themes/hugo-book/layouts/_default/baseof.html |  2 +-
 5 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/docs/assets/_custom.scss b/docs/assets/_custom.scss
index 01d26f0..1d39627 100644
--- a/docs/assets/_custom.scss
+++ b/docs/assets/_custom.scss
@@ -53,15 +53,31 @@ ul#book-search-results {
   list-style-type: none;
   float: left;
   width: 100%;
-  background-color: white;
-  z-index: 10;
+  max-height: 700px;
+  overflow-y: scroll;
+  border-radius: 6px;
+
+  z-index: 1;
   a b mark {
     background-color: #B8E1F3;
   }
 }
 
-ul#book-search-results li small {
+ul#book-search-results li {
   color: rgb(112, 128, 144);
+  background-color: white;
+  border-bottom: 1px solid #e7e8eb;
+  padding-bottom: 15px;
+  padding-left: 10px;
+  margin: 0px;
+  display: grid;
+}
+
+
+
+ul#book-search-results li p {
+   font-weight: bold;
+    margin-bottom: 4px;
 }
 
 .book-section-flat {
diff --git a/docs/assets/search.js b/docs/assets/search.js
index 3dc1050..fa86268 100644
--- a/docs/assets/search.js
+++ b/docs/assets/search.js
@@ -93,7 +93,7 @@
     const searchHits = window.pages.filter(page => page.content.toLowerCase().includes(input.value.toLowerCase()) )
     searchHits.forEach(function (page) {
 
-      var contentPreview = getSearchPreview(page, input.value, 30);
+      var contentPreview = getSearchPreview(page, input.value, 50);
 
       const li = element('<li><p></p><small></small></li>');
       const p = li.querySelector('p'), small = li.querySelector('small');
diff --git a/docs/themes/hugo-book/layouts/_default/baseof.html b/docs/layouts/_default/baseof.html
similarity index 82%
copy from docs/themes/hugo-book/layouts/_default/baseof.html
copy to docs/layouts/_default/baseof.html
index 3b2a7fc..ab132e8 100644
--- a/docs/themes/hugo-book/layouts/_default/baseof.html
+++ b/docs/layouts/_default/baseof.html
@@ -15,6 +15,16 @@
     </aside>
 
     <div class="book-page">
+      <div class="book-search">
+        <input type="text" id="book-search-input" placeholder="{{ i18n "Search" }}" aria-label="{{ i18n "Search" }}" maxlength="64" data-hotkeys="s/" />
+      </div>
+      <div >
+        <ul id="book-search-results">
+          <!--Reserve a <li> to solve safari compatibility problem-->
+          <li id="liFirst" style="background-color:#e7e8eb00; border-bottom:#e7e8eb00; color:#e7e8eb00;">.</li>
+        </ul>
+      </div>
+      </br>
       <header class="book-header">
         {{ template "header" . }} <!-- Mobile layout header -->
       </header>
diff --git a/docs/layouts/partials/docs/search.html b/docs/layouts/partials/docs/search.html
index c497ecc..150057a 100644
--- a/docs/layouts/partials/docs/search.html
+++ b/docs/layouts/partials/docs/search.html
@@ -1,8 +1,6 @@
 {{ if default true .Site.Params.BookSearch }}
 <div class="book-search">
-  <input type="text" id="book-search-input" placeholder="{{ i18n "Search" }}" aria-label="{{ i18n "Search" }}" maxlength="64" data-hotkeys="s/" />
   <div class="book-search-spinner hidden"></div>
-  <ul id="book-search-results"></ul>
   <a href="https://github.com/apache/iceberg" target="_blank">
     <img src="{{ .Site.BaseURL }}/img/GitHub-Mark.png" target="_blank" class="top-external-icon"/>
   </a>
diff --git a/docs/themes/hugo-book/layouts/_default/baseof.html b/docs/themes/hugo-book/layouts/_default/baseof.html
index 3b2a7fc..b8628da 100644
--- a/docs/themes/hugo-book/layouts/_default/baseof.html
+++ b/docs/themes/hugo-book/layouts/_default/baseof.html
@@ -80,4 +80,4 @@
 
 {{ define "toc" }}
   {{ partial "docs/toc" . }}
-{{ end }}
+{{ end }}
\ No newline at end of file