Redesign nav search
This commit is contained in:
@@ -1,63 +1,111 @@
|
|||||||
<div class="flex items-center">
|
<div class="flex items-center relative">
|
||||||
<form method="POST" action="{{ route('hentai.searchredirect') }}">
|
<form method="POST" action="{{ route('hentai.searchredirect') }}" class="w-full">
|
||||||
@csrf
|
@csrf
|
||||||
<label for="live-search" class="mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white">Search</label>
|
<div class="relative group">
|
||||||
<div class="absolute right-2 left-2 sm:relative sm:min-w-[200px] md:min-w-[300px] lg:min-w-[400px] xl:min-w-[500px] transition-all">
|
<label for="live-search" class="sr-only">Search</label>
|
||||||
<div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none">
|
<div class="relative w-full sm:min-w-[200px] md:min-w-[300px] lg:min-w-[400px] xl:min-w-[500px]">
|
||||||
<svg class="w-4 h-4 text-gray-500 dark:text-gray-400" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
|
{{-- Search Icon --}}
|
||||||
|
<div class="pointer-events-none absolute inset-y-0 left-0 pl-3 flex items-center">
|
||||||
|
<svg class="w-4 h-4 text-gray-400 dark:text-gray-300" 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" d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"/>
|
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"/>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<input wire:model.live.debounce.600ms="navSearch" type="search" id="live-search" name="live-search" class="block p-4 pl-10 w-full text-sm text-gray-900 rounded-lg border border-gray-300/50 bg-gray-50/20 focus:ring-rose-800 focus:border-rose-900 dark:bg-neutral-900/40 dark:border-neutral-600/50 dark:placeholder-gray-400 dark:text-white dark:focus:ring-rose-800 dark:focus:border-rose-900" placeholder="@if(request()->path() !== 'search'){{ __('search.search-hentai') }}@endif" required @if(request()->path() == 'search') disabled @endif>
|
|
||||||
<button type="submit" class="absolute right-2.5 bottom-2.5 px-4 py-2 text-sm font-medium text-white bg-rose-700 rounded-lg hover:bg-rose-800 disabled:bg-gray-300 disabled:hover:bg-gray-300 disabled:dark:bg-gray-500 disabled:dark:hover:bg-gray-500 focus:ring-4 focus:outline-none focus:ring-rose-300 dark:bg-rose-600 dark:hover:bg-rose-700 dark:focus:ring-rose-800" @if(request()->path() == 'search') disabled @endif>{{ __('search.search') }}</button>
|
{{-- Search Input --}}
|
||||||
|
<input
|
||||||
|
wire:model.live.debounce.600ms="navSearch"
|
||||||
|
type="search"
|
||||||
|
id="live-search"
|
||||||
|
name="live-search"
|
||||||
|
class="block w-full pl-10 pr-28 py-3 text-sm rounded-2xl border border-gray-200 bg-white/80 dark:bg-neutral-900/50 dark:border-neutral-700 placeholder-gray-400 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-rose-600 focus:border-rose-700 transition"
|
||||||
|
placeholder="@if(request()->path() !== 'search'){{ __('search.search-hentai') }}@endif"
|
||||||
|
required
|
||||||
|
@if(request()->path() == 'search') disabled @endif
|
||||||
|
aria-autocomplete="list"
|
||||||
|
aria-label="Search"
|
||||||
|
>
|
||||||
|
|
||||||
|
{{-- Submit button to redirect to advanced search --}}
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="absolute right-1 top-1/2 -translate-y-1/2 px-4 py-2 text-sm font-medium rounded-xl bg-rose-700 text-white hover:bg-rose-800 focus:outline-none focus:ring-2 focus:ring-rose-300 disabled:bg-gray-300 disabled:hover:bg-gray-300 disabled:dark:bg-gray-500 disabled:dark:hover:bg-gray-500"
|
||||||
|
@if(request()->path() == 'search') disabled @endif
|
||||||
|
>{{ __('search.search') }}</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
|
||||||
|
|
||||||
@if((! $hide) && request()->path() != 'search' && request()->path() != 'download-search')
|
@if((! $hide) && request()->path() != 'search' && request()->path() != 'download-search')
|
||||||
<!-- BG Blur and BG Size -->
|
<div
|
||||||
<div class="absolute left-0 sm:top-[65px] w-[100%] h-[calc(100vh-60px)] z-40 text-gray-900 dark:text-white bg-neutral-100/80 dark:bg-neutral-900/80">
|
class="pointer-events-auto absolute left-0 right-0 mt-3 z-50 flex justify-center"
|
||||||
<div class="flex justify-center items-center">
|
aria-live="polite"
|
||||||
<!-- Padding for Grid -->
|
>
|
||||||
<div class="flex justify-center w-5/6">
|
<div
|
||||||
<div class="grid grid-cols-1 gap-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5">
|
class="max-h-[70vh] overflow-auto rounded-2xl bg-white dark:bg-neutral-900 border border-gray-200 dark:border-neutral-700 shadow-lg transition-all transform hidden group-focus-within:block group-focus-within:translate-y-0">
|
||||||
@foreach($episodes as $episode)
|
<div class="flex items-center justify-between p-3 border-b border-gray-100 dark:border-neutral-800">
|
||||||
<div class="relative p-1 mb-8 w-full transition duration-300 ease-in-out md:p-2 hover:-translate-y-1 hover:scale-110">
|
<div class="text-sm text-gray-700 dark:text-gray-200 font-medium">
|
||||||
<a class="hover:text-blue-600" href="{{ route('hentai.index', ['title' => $episode->slug ]) }}">
|
@if($episodes->count())
|
||||||
<div class="absolute w-[95%] top-[38%] text-center z-10">
|
{{ __('Search result for ') }} “{{ $query ?: $navSearch }}”
|
||||||
<svg aria-hidden="true" class="inline mr-2 w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-pink-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
|
@else
|
||||||
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/>
|
{{ __('No results') }}
|
||||||
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/>
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Loading indicator using Livewire --}}
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<div wire:loading.class.remove="hidden" class="hidden">
|
||||||
|
<svg class="w-5 h-5 animate-spin text-rose-600" viewBox="0 0 24 24" fill="none">
|
||||||
|
<circle cx="12" cy="12" r="10" stroke="currentColor" stroke-opacity="0.2" stroke-width="4"></circle>
|
||||||
|
<path d="M22 12a10 10 0 0 1-10 10" stroke="currentColor" stroke-width="4" stroke-linecap="round"></path>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- content area: responsive grid --}}
|
||||||
|
<div class="p-4">
|
||||||
|
@if($episodes->count())
|
||||||
|
<div class="grid grid-cols-1 gap-4 md:grid-cols-1 lg:grid-cols-2">
|
||||||
|
@foreach($episodes as $episode)
|
||||||
|
<a href="{{ route('hentai.index', ['title' => $episode->slug ]) }}" class="group block rounded-xl overflow-hidden bg-neutral-50 dark:bg-neutral-950 border border-transparent hover:border-gray-200 dark:hover:border-neutral-700 shadow-sm hover:shadow-md transition">
|
||||||
|
<div class="relative aspect-video">
|
||||||
<img
|
<img
|
||||||
alt="{{ $episode->title }} - {{ $episode->episode }}"
|
alt="{{ $episode->title }} - {{ $episode->episode }}"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
width="500"
|
class="object-cover w-full h-full"
|
||||||
class="block object-cover object-center relative z-20 rounded-lg aspect-video"
|
src="{{ $episode->gallery->first()->thumbnail_url }}"
|
||||||
src="{{ $episode->gallery->first()->thumbnail_url }}">
|
>
|
||||||
</img>
|
<span class="absolute right-0 top-0 bg-white/90 dark:bg-neutral-800/80 dark:text-white text-xs font-semibold rounded-tr rounded-bl-xl px-2 py-1">{{ $episode->getResolution() }}</span>
|
||||||
<p class="absolute right-4 top-4 bg-white/80 dark:bg-neutral-700/80 !text-gray-900 dark:!text-white rounded-bl-lg rounded-lg p-1 pr-2 pl-2 font-semibold text-sm">{{ $episode->getResolution() }}</p>
|
<div class="absolute left-0 bottom-0 bg-white/90 dark:bg-neutral-800/80 dark:text-white text-xs rounded-tr-xl px-2 py-1 font-medium">
|
||||||
<p class="absolute left-4 bottom-4 bg-white/80 dark:bg-neutral-700/80 !text-gray-900 dark:!text-white rounded-bl-lg rounded-lg p-1 pr-2 pl-2 font-semibold text-sm"><i class="fa-regular fa-eye"></i> {{ $episode->view_count }} <i class="fa-regular fa-heart"></i> {{ count($episode->likes) }}</p>
|
<i class="fa-regular fa-eye mr-1"></i> {{ $episode->view_count }}
|
||||||
<p class="absolute w-[95%] text-center text-sm">{{ $episode->title }} - {{ $episode->episode }}</p>
|
<i class="fa-regular fa-heart ml-2"></i> {{ count($episode->likes) }}
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="p-3">
|
||||||
|
<h3 class="text-sm font-semibold truncate text-gray-900 dark:text-white">{{ $episode->title }} - {{ $episode->episode }}</h3>
|
||||||
|
<p class="text-xs text-gray-500 dark:text-gray-400 mt-1 truncate"> {{ \Illuminate\Support\Str::limit($episode->description ?? '', 80) }}</p>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
@endforeach
|
@endforeach
|
||||||
<div class="relative p-1 mb-8 w-full transition duration-300 ease-in-out md:p-2 hover:-translate-y-1 hover:scale-110">
|
|
||||||
<a class="hover:text-blue-600" href="{{ route('hentai.search', ['s' => $query]) }}">
|
{{-- Advanced Search card --}}
|
||||||
<img
|
<a href="{{ route('hentai.search', ['search' => $query]) }}" class="flex items-center justify-center rounded-xl border border-dashed border-gray-200 dark:border-neutral-700 p-6 hover:bg-gray-50 dark:hover:bg-neutral-900 transition">
|
||||||
alt="gallery"
|
<div class="text-center">
|
||||||
loading="lazy"
|
<div class="text-2xl font-bold text-rose-600 mb-1">🔎</div>
|
||||||
width="500"
|
<div class="font-semibold text-sm dark:text-white">Advanced Search</div>
|
||||||
class="block object-cover object-center rounded-lg aspect-video"
|
<div class="text-xs text-gray-500 dark:text-gray-400 mt-1">View more results</div>
|
||||||
src="{{ $randomimage->thumbnail_url }}">
|
</div>
|
||||||
</img>
|
|
||||||
<p class="absolute left-2 top-2 w-[95%] h-[91.5%] bg-white/10 dark:bg-neutral-700/10 !text-gray-900 dark:!text-white rounded-bl-lg rounded-lg font-semibold p-4 pr-8 pl-8 text-center"></p>
|
|
||||||
<p class="absolute left-[20%] top-[35%] bg-white/80 dark:bg-neutral-700/80 !text-gray-900 dark:!text-white rounded-bl-lg rounded-lg font-semibold p-4 pr-8 pl-8 text-center">Advanced Search...</p>
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@else
|
||||||
|
{{-- Empty state --}}
|
||||||
|
<div class="py-12 text-center text-sm text-gray-600 dark:text-gray-300">
|
||||||
|
<div class="mb-3">No results found for “{{ $query ?: $navSearch }}”</div>
|
||||||
|
<a href="{{ route('hentai.search', ['search' => $navSearch ?: $query]) }}" class="inline-block px-4 py-2 rounded-lg bg-rose-700 text-white text-sm hover:bg-rose-800">Try advanced search</a>
|
||||||
</div>
|
</div>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user