Don't render empty state instead of hiding it

This commit is contained in:
Adrien Maston
2026-02-19 14:04:14 +01:00
parent 542777409c
commit 97f2f677d6
4 changed files with 6 additions and 11 deletions
-5
View File
@@ -129,9 +129,4 @@ summary {
padding-inline: 0;
}
}
.search-perma--empty {
.search {
display: none;
}
}
}
+2 -2
View File
@@ -3,10 +3,10 @@ class SearchesController < ApplicationController
def show
@query = params[:q].blank? ? nil : params[:q]
if card = Current.user.accessible_cards.find_by_id(params[:q])
if card = Current.user.accessible_cards.find_by_id(@query)
@card = card
else
set_page_and_extract_portion_from Current.user.search(params[:q])
set_page_and_extract_portion_from Current.user.search(@query)
@recent_search_queries = Current.user.search_queries.order(updated_at: :desc).limit(10)
end
end
+1 -1
View File
@@ -1,6 +1,6 @@
<section class="search">
<div class="search__results">
<% unless page.used? %>
<% unless page.used? || !query %>
<div class="search__blank-slate blank-slate">
No matches
</div>
+3 -3
View File
@@ -8,13 +8,13 @@
<h1 class="header__title" data-bridge--title-target="header"><%= @page_title %></h1>
<% end %>
<%= tag.div(class: token_list("search-perma", {"search-perma--empty": !@query}, "margin-block-start")) do %>
<div class="search-perma margin-block-start">
<%= render "form", query_terms: @query %>
<%= turbo_frame_tag "bar_content" do %>
<% if @card %>
<%= auto_submit_form_with url: card_path(@card), method: :get, data: { turbo_action: "advance", turbo_frame: "_top", search_redirect: true } %>
<% else %>
<%= render "results", page: @page %>
<%= render "results", page: @page, query: @query %>
<% end %>
<% end %>
<% end %>
</div>