From 0a9d16bf2d11def175d844a2ff57bfed03446475 Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Tue, 22 Apr 2025 22:29:33 -0500 Subject: [PATCH] New menu filters and navigates --- app/assets/stylesheets/popup.css | 67 ++++++++++++++++--- .../cards/index/_collections_filter.html.erb | 29 ++++---- app/views/cards/index/_header.html.erb | 9 ++- app/views/events/_filter.html.erb | 2 +- 4 files changed, 84 insertions(+), 23 deletions(-) diff --git a/app/assets/stylesheets/popup.css b/app/assets/stylesheets/popup.css index 5c8ec1b95..f674b25e2 100644 --- a/app/assets/stylesheets/popup.css +++ b/app/assets/stylesheets/popup.css @@ -5,10 +5,11 @@ --panel-size: auto; inline-size: auto; - inset: 0 auto auto 0; + inset: 0 auto auto 50%; min-inline-size: 20ch; max-inline-size: 40ch; position: absolute; + transform: translateX(-50%); z-index: 2; &[open] { @@ -16,8 +17,19 @@ } } + .popup__group { + background: var(--color-subtle-light); + padding-inline-start: var(--inline-space-half); + + @media (any-hover: hover) { + &:hover { + background: var(--color-selected); + } + } + } + .popup__item { - --btn-background: var(--color-subtle-light); + --btn-background: transparent; --btn-border-radius: 0.3em; --btn-border-size: 0; --btn-font-weight: 500; @@ -37,12 +49,6 @@ } - @media (any-hover: hover) { - &:where(:not(:active):hover) { - --btn-background: var(--color-selected); - } - } - &:has(input:checked) { --btn-background: var(--color-selected); --btn-color: var(--color-ink); @@ -82,3 +88,48 @@ font-weight: 800; } } + +.popup--animated { + --backdrop-speed: 150ms; + --panel-size: max-content; + --speed: 150ms; + + opacity: 0; + transform: scale(0.2) translateX(-50%); + transform-origin: top left; + transition: + display var(--speed) allow-discrete, + opacity var(--speed), + overlay var(--speed) allow-discrete, + transform var(--speed); + + &::backdrop { + background-color: var(--color-always-black); + opacity: 0; + transform: scale(1); + transition: + display var(--backdrop-speed) allow-discrete, + opacity var(--backdrop-speed), + overlay var(--backdrop-speed) allow-discrete; + } + + &[open] { + opacity: 1; + transform: scale(1) translateX(-50%); + + &::backdrop { + opacity: 0.5; + } + } + + @starting-style { + &[open] { + opacity: 0; + transform: scale(0.2) translateX(-50%); + } + + &[open]::backdrop { + opacity: 0; + } + } +} diff --git a/app/views/cards/index/_collections_filter.html.erb b/app/views/cards/index/_collections_filter.html.erb index b81481ad7..80802f6f8 100644 --- a/app/views/cards/index/_collections_filter.html.erb +++ b/app/views/cards/index/_collections_filter.html.erb @@ -4,20 +4,25 @@ <%= filter_hidden_field_tag key, value %> <% end %> - <%= link_to cards_path(filter.as_params.except(:collection_ids)), class: "btn popup__item" do %> - All collections - <% end %> - <% Current.user.collections.order(:name).each do |collection| %> -