From 1f2ccd6e91ffb1e7226493ccfcd84981f1c6a10a Mon Sep 17 00:00:00 2001 From: danix Date: Wed, 1 Mar 2023 12:26:17 +0100 Subject: [PATCH] styling of the search bar. Improved functionality. Still needs styling. --- assets/js/search.js | 8 ++++---- assets/sass/components/_search.scss | 5 +++++ assets/sass/main.scss | 1 + layouts/partials/footer-addition.html | 2 -- layouts/partials/main-menu.html | 1 + layouts/partials/search.html | 22 ++++++++++++++++++++++ 6 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 assets/sass/components/_search.scss create mode 100644 layouts/partials/search.html diff --git a/assets/js/search.js b/assets/js/search.js index e609fbe..b45e0f0 100644 --- a/assets/js/search.js +++ b/assets/js/search.js @@ -31,12 +31,12 @@ import * as params from '@params'; const item = items[id]; const result = template.cloneNode(true); const a = result.querySelector('a'); - const time = result.querySelector('time'); - const content = result.querySelector('.content'); + // const time = result.querySelector('time'); + // const content = result.querySelector('.content'); a.innerHTML = item.title; a.href = item.permalink; - time.innerText = item.date; - content.innerHTML = item.summary; + // time.innerText = item.date; + // content.innerHTML = item.summary; fragment.appendChild(result); } results.appendChild(fragment); diff --git a/assets/sass/components/_search.scss b/assets/sass/components/_search.scss new file mode 100644 index 0000000..1fdc1f3 --- /dev/null +++ b/assets/sass/components/_search.scss @@ -0,0 +1,5 @@ + #search-container { + div.search-results { + overflow-y: scroll; + } + } diff --git a/assets/sass/main.scss b/assets/sass/main.scss index 26fae48..6d26e38 100644 --- a/assets/sass/main.scss +++ b/assets/sass/main.scss @@ -60,6 +60,7 @@ @import 'components/tiles'; @import 'components/contact-method'; @import 'components/spotlights'; + @import 'components/search'; // Layout. diff --git a/layouts/partials/footer-addition.html b/layouts/partials/footer-addition.html index 0148109..e97077c 100644 --- a/layouts/partials/footer-addition.html +++ b/layouts/partials/footer-addition.html @@ -18,10 +18,8 @@ {{ end -}} -{{ if .HasShortcode "search" -}} {{ $flexsearch := resources.Get "js/flexsearch.compact.js" | fingerprint -}} {{ $search_opts := dict "minify" true "params" (dict "searchLimit" (site.Params.searchLimit | default 20)) -}} {{ $search := resources.Get "js/search.js" | js.Build $search_opts | fingerprint -}} -{{ end -}} diff --git a/layouts/partials/main-menu.html b/layouts/partials/main-menu.html index 573f030..dc57060 100644 --- a/layouts/partials/main-menu.html +++ b/layouts/partials/main-menu.html @@ -19,5 +19,6 @@ {{ end }} {{ end }} +
  • {{- partial "search.html" . -}}
  • diff --git a/layouts/partials/search.html b/layouts/partials/search.html new file mode 100644 index 0000000..9d5d852 --- /dev/null +++ b/layouts/partials/search.html @@ -0,0 +1,22 @@ +
    +

    JavaScript is required for this form to work

    + + + + +
    + + +
    -- 2.20.1