{{ define "title" }}Search &middot; {{ .RepoInfo.FullName }} &middot; Tangled{{ end }}

{{ define "extrameta" }}
    {{ template "repo/fragments/meta" . }}

    {{ template "repo/fragments/og" (dict "RepoInfo" .RepoInfo) }}
{{ end }}

{{ define "repoContent" }}
<main>
  <div class="flex relative w-full mb-4">
    <div class="flex-1 flex relative">
      <span class="absolute left-2 top-1/2 -translate-y-1/2 text-gray-400">
        {{ i "search-code" "size-4" }}
      </span>
      <input
        type="text"
        name="q"
        value="{{ .FilterQuery }}"
        placeholder="Find files or code"
        hx-get=""
        hx-trigger="{{ if .FilterQuery }}load, {{ end }}input changed delay:100ms from:input"
        hx-target="#repo-files"
        hx-swap="outerHTML"
        autofocus
        class="font-mono flex-1 py-1 pl-8 pr-2 peer"
      >
    </div>
  </div>
  {{ if not .LoggedInUser }}
    <div class="flex items-center gap-2 my-2 bg-orange-50 dark:bg-orange-900/30 border border-orange-300 dark:border-orange-700 rounded px-3 py-2 text-orange-600 dark:text-orange-300 text-sm">
      {{ i "circle-alert" "size-4" }}
      <span><a href="/login" class="underline">Login</a> to search files or codes.</span>
    </div>
  {{ else }}
    {{ template "repo/fragments/searchResults" dict }}
  {{ end }}
</main>
{{ end }}
