Files

43 lines
1.5 KiB
HTML

{{ define "search" }}
<!DOCTYPE html>
<html lang="en">
<head>
{{ template "head" . }}
{{ template "meta" .Meta }}
</head>
<body>
{{ template "nav" . }}
<main id="main-content" class="container mx-auto px-4 py-8">
{{ if .SearchQuery }}
<h1 class="text-2xl font-bold mb-6 wrap-break-word line-clamp-2">Search Results for "{{ .SearchQuery }}"</h1>
{{ else }}
<h1 class="text-2xl font-bold mb-2">Search</h1>
<p class="text-base-content/60 mb-6">Enter a search term to find images.</p>
{{ end }}
{{/* Noscript fallback: a plain GET form so users without JavaScript
can still search. The nav search box posts to /search too, but
that's above the fold of the page result; this gives a stable
on-page form at the top of results. */}}
<noscript>
<form action="/search" method="get" class="mb-6 flex gap-2">
<input type="text" name="q" value="{{ .SearchQuery }}"
class="input input-bordered flex-1"
placeholder="Search images">
<button type="submit" class="btn btn-primary">Search</button>
</form>
</noscript>
<div id="search-results" role="region" aria-live="polite" aria-busy="false">
{{ if .SearchQuery }}
{{ template "search-results" .Results }}
{{ end }}
</div>
</main>
{{ template "footer" . }}
</body>
</html>
{{ end }}