78 lines
3.4 KiB
Plaintext
78 lines
3.4 KiB
Plaintext
<% content_for :title, "Sanasto Wiki" %>
|
||
|
||
<div class="min-h-screen flex flex-col">
|
||
<header class="bg-white border-b border-slate-200">
|
||
<div class="max-w-7xl mx-auto px-4">
|
||
<div class="h-16 flex items-center justify-between">
|
||
<div class="flex items-center gap-2">
|
||
<span class="text-xl font-bold tracking-tight text-indigo-600">Sanasto</span>
|
||
<span class="text-xl font-light text-slate-400">Wiki</span>
|
||
</div>
|
||
<div class="flex items-center gap-3">
|
||
<%= link_to "Download XLSX", download_entries_path(format: :xlsx),
|
||
class: "text-xs font-bold text-indigo-700 px-3 py-2 rounded-md border border-indigo-200 bg-indigo-50 hover:bg-indigo-100 transition" %>
|
||
<%= link_to "Sign In", "#", class: "bg-indigo-600 text-white px-4 py-2 rounded-lg text-sm font-semibold hover:bg-indigo-700 transition" %>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</header>
|
||
|
||
<div class="flex-1 flex flex-col">
|
||
<section class="bg-white border-b border-slate-200">
|
||
<div class="max-w-7xl mx-auto px-4 pb-6 space-y-4">
|
||
<%= form_with url: entries_path,
|
||
method: :get,
|
||
data: { turbo_stream: true } do |form| %>
|
||
<div class="relative">
|
||
<div class="absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none">
|
||
<svg class="h-5 w-5 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
|
||
</svg>
|
||
</div>
|
||
<div class="absolute inset-y-0 right-0 pr-4 flex items-center">
|
||
<button type="button"
|
||
class="text-slate-400 hover:text-slate-600 text-2xl leading-none <%= @query.present? ? "" : "hidden" %>"
|
||
data-clear-search
|
||
aria-label="Clear search"
|
||
onclick="const input=this.closest('form').querySelector('input[name=q]'); if(input){input.value='';} this.closest('form').requestSubmit();">
|
||
×
|
||
</button>
|
||
</div>
|
||
<%= form.text_field :q,
|
||
value: @query,
|
||
placeholder: "Search words, phrases, or biblical terms...",
|
||
class: "block w-full pl-11 pr-10 mt-2 mb-2 py-4 bg-white border border-slate-200 rounded-2xl shadow-sm focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition",
|
||
oninput: "const clearBtn=this.form.querySelector('[data-clear-search]'); if(clearBtn){clearBtn.classList.toggle('hidden', this.value.length===0);} this.form.requestSubmit();" %>
|
||
</div>
|
||
<% end %>
|
||
|
||
<div id="entries_filters" class="hidden">
|
||
<%= render "entries/filters" %>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<div id="entries_results">
|
||
<%= render "entries/results" %>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<script>
|
||
document.addEventListener("click", function (event) {
|
||
const toggle = event.target.closest("[data-toggle-filters]");
|
||
if (!toggle) {
|
||
return;
|
||
}
|
||
|
||
const panel = document.getElementById("entries_filters");
|
||
if (!panel) {
|
||
return;
|
||
}
|
||
|
||
const isHidden = panel.classList.toggle("hidden");
|
||
toggle.setAttribute("aria-expanded", (!isHidden).toString());
|
||
toggle.textContent = isHidden ? "Show Filters" : "Hide Filters";
|
||
});
|
||
</script>
|