diff --git a/app/assets/stylesheets/popup.css b/app/assets/stylesheets/popup.css
index 989d6af99..894e7b4d1 100644
--- a/app/assets/stylesheets/popup.css
+++ b/app/assets/stylesheets/popup.css
@@ -45,8 +45,6 @@
white-space: nowrap;
}
- .popup__section {}
-
.popup__section-title {
background: var(--color-canvas);
font-size: var(--text-small);
@@ -61,6 +59,25 @@
&::-webkit-details-marker {
display: none;
}
+
+ &:is(summary) {
+ align-items: center;
+ cursor: pointer;
+ display: flex;
+ gap: 2ch;
+ justify-content: space-between;
+ }
+
+ .icon--caret-down {
+ opacity: 0.66;
+ transition: rotate 150ms ease-out;
+ }
+
+ .popup__section:not([open]) & {
+ .icon--caret-down {
+ rotate: -90deg;
+ }
+ }
}
.popup__list {
diff --git a/app/helpers/filters_helper.rb b/app/helpers/filters_helper.rb
index ea155ccfd..797682c51 100644
--- a/app/helpers/filters_helper.rb
+++ b/app/helpers/filters_helper.rb
@@ -20,7 +20,6 @@ module FiltersHelper
concat icon_tag(icon, class: "popup__icon")
concat(link_to(path, class: "popup__btn btn") do
concat tag.span(label, class: "overflow-ellipsis")
- concat tag.span(" ›", class: "translucent flex-item-no-shrink flex-item-justify-end")
end)
end
end
@@ -36,6 +35,18 @@ module FiltersHelper
}, &block
end
+ def filter_collapsible_section(title, &block)
+ tag.details class: "popup__section", open: true do
+ concat(tag.summary(class: "popup__section-title") do
+ concat title
+ concat icon_tag "caret-down"
+ end)
+ concat(tag.ul(class: "popup__list") do
+ capture(&block)
+ end)
+ end
+ end
+
def filter_hotkey_link(title, path, key, icon)
link_to path, class: "popup__item btn borderless", id: "filter-hotkey-#{key}", role: "listitem", data: { filter_target: "item", navigable_list_target: "item", controller: "hotkey", action: "keydown.#{key}@document->hotkey#click keydown.shift+#{key}@document->hotkey#click" } do
concat icon_tag(icon)
diff --git a/app/views/filters/menu/_collections.html.erb b/app/views/filters/menu/_collections.html.erb
index 48897047f..5dd859360 100644
--- a/app/views/filters/menu/_collections.html.erb
+++ b/app/views/filters/menu/_collections.html.erb
@@ -1,11 +1,8 @@
<% if user_filtering.collections.any? %>
- Collections
+ <%= filter_collapsible_section "Collections" do %>
<%= form_with url: user_filtering.self_filter_path, method: :get, data: { controller: "form" } do |form| %>
-
- <%= render "filters/menu/collections/all_option", form: form, user_filtering: user_filtering %>
- <%= render partial: "filters/menu/collections/collection", collection: user_filtering.collections, as: :collection, locals: { form: form, user_filtering: user_filtering } %>
-
+ <%= render "filters/menu/collections/all_option", form: form, user_filtering: user_filtering %>
+ <%= render partial: "filters/menu/collections/collection", collection: user_filtering.collections, as: :collection, locals: { form: form, user_filtering: user_filtering } %>
<% end %>
-