]> _ Git - odl.git/commitdiff
wip #5120
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 22 Feb 2022 15:25:03 +0000 (16:25 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 22 Feb 2022 15:25:03 +0000 (16:25 +0100)
resources/js/search.js
resources/views/components/search.blade.php

index 328d2cc008dad96992152f917c4f06d7309b5179..430fc98e297062122714189684ab95e764e4054e 100644 (file)
@@ -14,7 +14,9 @@ export default () => ({
             prefix: true, // Allow partial matches
             processTerm: (term, _fieldName) => term.length < 3 ? null : term.toLowerCase()
         },
-    }, query: '', // The search query
+    },
+    querystring: '', // The search query
+    query: '', // The search query
     medialibrary: '', // Holds URL of the media library that is passed in from the component
 
     async init() {
@@ -54,8 +56,6 @@ export default () => ({
             return [];
         }
 
-        console.log(this.query);
-
         return this.miniSearch.search(this.query);
     },
 
index 86db3bf1175cfd15faeaed52e66b448754d7d549..e968a557dd5fd65c85e7d5afb9cc4b2b3b9dd021 100644 (file)
@@ -42,7 +42,8 @@
                 type="search"
                 placeholder="Recherche"
                 @keyup.enter="$el.blur()" {{-- Remove focus on enter in order to hide virtual keyboard --}}
-                x-model="query"
+                x-on:change="query=querystring"
+                x-model="querystring"
                 class="appearance-none outline-none bg-white
                        mt-8 w-full
                        font-semibold text-6xl uppercase
 
     {{-- Search Results --}}
     <div class="flex-1 max-h-full w-full overflow-y-auto"
-         x-show="showResults"
+         x-show="searchOpen"
          x-transition:enter.opacity.duration.500ms.delay.1500ms
          x-transition:leave.opacity.delay.50ms>
-        <div class="font-secondary font-medium">
+        <div x-show="query !== ''" class="font-secondary font-medium">
             <p x-text="resultCount" class="mt-15 opacity-50"></p>
 
             <div class="h-full max-h-full overflow-y-auto">