Merge pull request #365 from teaxyz/display-number-of-packages

Display Number of Packages
This commit is contained in:
Thomas Smith 2023-05-24 10:54:22 +02:00 committed by GitHub
commit 26473a9586
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View file

@ -5,7 +5,6 @@
<div class="row"> <div class="row">
<div class="col"> <div class="col">
{{- partial "search-menu.html" "searchTermDesktop" -}} {{- partial "search-menu.html" "searchTermDesktop" -}}
<hr>
<div class="package-grid"> <div class="package-grid">
@ -94,6 +93,7 @@
overflow: hidden; overflow: hidden;
} }
</style> </style>
<script language="javascript" type="module"> <script language="javascript" type="module">
import Fuse from 'https://cdn.jsdelivr.net/npm/fuse.js@6.6.2/dist/fuse.esm.js' import Fuse from 'https://cdn.jsdelivr.net/npm/fuse.js@6.6.2/dist/fuse.esm.js'
@ -109,6 +109,11 @@
const grid = document.getElementById('packageGrid'); const grid = document.getElementById('packageGrid');
const packagesCache = Array.from(grid.children).filter((e) => e.dataset && e.dataset.name); const packagesCache = Array.from(grid.children).filter((e) => e.dataset && e.dataset.name);
// get reference to search input and set its placeholder
const searchInput = document.getElementById('searchTermDesktop');
searchInput.placeholder = `Search ${packagesCache.length} packages`;
const packagesIndex = new Fuse(packagesCache.map((p) => p.dataset), { const packagesIndex = new Fuse(packagesCache.map((p) => p.dataset), {
keys: ["name", "maintainer", "description"], keys: ["name", "maintainer", "description"],
minMatchCharLength: 3, minMatchCharLength: 3,

View file

@ -5,7 +5,8 @@
<div class="icon"> <div class="icon">
<i class="icon-search-icon"></i> <i class="icon-search-icon"></i>
</div> </div>
<input id="{{- . -}}" type="search" placeholder="search_" /> <!-- Save the input element to a variable to be able to refer to it later -->
<input id="{{- . -}}" type="search" placeholder="Search packages" />
</div> </div>
{{- partial "sort-dropdown.html" -}} {{- partial "sort-dropdown.html" -}}
</div> </div>
@ -13,7 +14,6 @@
</section> </section>
<style> <style>
.icon-search-icon{ .icon-search-icon{
font-size: 30px; font-size: 30px;
color: #949494; color: #949494;
@ -38,7 +38,7 @@
color:#00ffd0; color:#00ffd0;
text-transform:uppercase; text-transform:uppercase;
margin-bottom: -5px; margin-bottom: -5px;
min-width: 60%; min-width: 100%;
padding: 0px; padding: 0px;
background-color: #1a1a1a !important; background-color: #1a1a1a !important;
border: none; border: none;