made search pretty and more usable

This commit is contained in:
John O'Keefe 2024-07-26 16:48:06 -04:00
parent d89121a4de
commit 33d1d1cfde
2 changed files with 14 additions and 8 deletions

View File

@ -29,9 +29,11 @@
class="rounded-s-lg block p-2.5 w-full z-20 text-sm text-gray-900 bg-gray-50 rounded-e-lg border-s-gray-50 border-s-2 border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-s-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:border-blue-500"
placeholder="Search for Anime" required/>
<button id="aniListSearchButton" data-dropdown-toggle="aniListSearch"
data-dropdown-offset-distance="0"
data-dropdown-offset-skidding="-50"
data-dropdown-placement="bottom"
class="absolute top-0 end-0 h-full p-2.5 text-sm font-medium text-white bg-blue-700 rounded-e-lg border border-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
on:click={runAniListSearch}>
on:click={() => {if(aniSearch.length > 0) runAniListSearch()}}>
<svg class="w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none"
viewBox="0 0 20 20">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
@ -43,21 +45,25 @@
</div>
</div>
<div id="aniListSearch" class="z-10 hidden bg-white rounded-lg shadow w-60 dark:bg-gray-700">
<div id="aniListSearch" class="z-10 hidden bg-white rounded-lg shadow w-80 dark:bg-gray-700">
{#if aniListSearchActive}
<ul class="h-48 py-2 overflow-y-auto text-gray-700 dark:text-gray-200"
<ul class="h-56 w-full py-2 overflow-y-auto text-gray-700 dark:text-gray-200"
aria-labelledby="aniListSearchButton">
{#each aniListSearch.data.Page.media as media}
<li>
<button on:click={() => GetAniListSingleItemAndOpenModal(media.id)}
class="flex items-center px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white">
<img class="w-6 h-6 me-2 rounded-full" src={media.coverImage.large}
<li class="w-full">
<button on:click={() => {
GetAniListSingleItemAndOpenModal(media.id)
}}
class="flex w-full items-start p-1 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white rounded-lg">
<img class="rounded-bl-lg rounded-tl-lg max-w-24 max-h-24" src={media.coverImage.large}
alt="{media.title.english === '' || media.title.english === null ? media.title.romaji : media.title.english} Cover">
<h3>{media.title.english === '' || media.title.english === null ? media.title.romaji : media.title.english }</h3>
<p class="bg-gray-800 text-left w-full h-24 p-2 rounded-tr-lg rounded-br-lg">{media.title.english === '' || media.title.english === null ? media.title.romaji : media.title.english }</p>
</button>
</li>
{/each}
</ul>
{:else if aniSearch.length === 0}
<div class="m-4">Please enter a search term...</div>
{/if}
<a href="#"
class="flex items-center p-3 text-sm font-medium text-blue-600 border-t border-gray-200 rounded-b-lg bg-gray-50 dark:border-gray-600 hover:bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 dark:text-blue-500 hover:underline">

View File