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? %> - + <% end %> <% end %> diff --git a/app/views/filters/menu/_custom.html.erb b/app/views/filters/menu/_custom.html.erb index b88827328..e9e061345 100644 --- a/app/views/filters/menu/_custom.html.erb +++ b/app/views/filters/menu/_custom.html.erb @@ -1,7 +1,6 @@ -<%= form_with url: cards_path, method: :get, data: { controller: "form" } do |form| %> - - + <% end %> <% end %> diff --git a/app/views/filters/menu/_places.html.erb b/app/views/filters/menu/_places.html.erb index cff259149..0bf30d8e4 100644 --- a/app/views/filters/menu/_places.html.erb +++ b/app/views/filters/menu/_places.html.erb @@ -1,10 +1,8 @@ - - - +<% end %> diff --git a/app/views/filters/menu/_tags.html.erb b/app/views/filters/menu/_tags.html.erb index 2c1f40983..1b2c27c86 100644 --- a/app/views/filters/menu/_tags.html.erb +++ b/app/views/filters/menu/_tags.html.erb @@ -1,5 +1,3 @@ - - - +<% end %> diff --git a/app/views/filters/menu/_users.html.erb b/app/views/filters/menu/_users.html.erb index 70dc9a077..cbc88ce98 100644 --- a/app/views/filters/menu/_users.html.erb +++ b/app/views/filters/menu/_users.html.erb @@ -1,4 +1,3 @@ - - +<% end %> diff --git a/app/views/filters/menu/collections/_all_option.html.erb b/app/views/filters/menu/collections/_all_option.html.erb index 00c7cf614..7745a4c64 100644 --- a/app/views/filters/menu/collections/_all_option.html.erb +++ b/app/views/filters/menu/collections/_all_option.html.erb @@ -12,7 +12,6 @@ <%= link_to clear_url_path, class: "popup__btn btn" do %> All collections - GO TO <% end %> <% end %> diff --git a/app/views/filters/menu/collections/_collection.html.erb b/app/views/filters/menu/collections/_collection.html.erb index 6eaa2c35e..d3d528b62 100644 --- a/app/views/filters/menu/collections/_collection.html.erb +++ b/app/views/filters/menu/collections/_collection.html.erb @@ -14,6 +14,5 @@ <%= link_to cards_path(collection_ids: [ collection ]), class: "popup__btn btn" do %> <%= collection.name %> - <% end %> diff --git a/app/views/filters/menu/custom/_create.html.erb b/app/views/filters/menu/custom/_create.html.erb index 42d40536a..e10d5313f 100644 --- a/app/views/filters/menu/custom/_create.html.erb +++ b/app/views/filters/menu/custom/_create.html.erb @@ -1,6 +1,6 @@ diff --git a/app/views/filters/menu/custom/_filter.html.erb b/app/views/filters/menu/custom/_filter.html.erb index d01a054e2..7f40cb83f 100644 --- a/app/views/filters/menu/custom/_filter.html.erb +++ b/app/views/filters/menu/custom/_filter.html.erb @@ -1,10 +1,9 @@ - diff --git a/app/views/filters/menu/tags/_tag.html.erb b/app/views/filters/menu/tags/_tag.html.erb index 1e2b8c2c7..3f502ba6b 100644 --- a/app/views/filters/menu/tags/_tag.html.erb +++ b/app/views/filters/menu/tags/_tag.html.erb @@ -2,6 +2,5 @@ <%= icon_tag "tag", class: "popup__icon" %> <%= link_to cards_path(tag_ids: [tag]), class: "popup__btn btn" do %> <%= tag.title %> (<%= tag.cards_count %>) - <% end %> diff --git a/app/views/filters/menu/users/_user.html.erb b/app/views/filters/menu/users/_user.html.erb index 6102a4c7f..e4e3ea9da 100644 --- a/app/views/filters/menu/users/_user.html.erb +++ b/app/views/filters/menu/users/_user.html.erb @@ -2,6 +2,5 @@ <%= icon_tag "person", class: "popup__icon" %> <%= link_to user, class: "popup__btn btn" do %> <%= user.name %> - <% end %>