public inbox for yew-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: yew-devel@lists.proxmox.com
Subject: [PATCH yew-widget-toolkit-assets 1/2] nav: add classes for animated navigation drawer menus
Date: Fri, 19 Jun 2026 09:44:27 +0200	[thread overview]
Message-ID: <20260619074434.705653-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20260619074434.705653-1-d.csapak@proxmox.com>

to animate expanding/collapsing of menus in navigation drawers, we have
to add some classes. Since we also want to be able to enable/disable
animation, use a css variable for the transition that is set
accordingly.

The only broadly compatible CSS way to animate the height of something
where the height is unknown ("auto"), is by using a grid layout and
using a '1fr' row template for it.

("auto" height is not animatable, and calc-size only exists in chrome
for now)

The markup has to be changed in the rust code for this to work.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 scss/_nav.scss | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/scss/_nav.scss b/scss/_nav.scss
index 08102d4..48cda9a 100644
--- a/scss/_nav.scss
+++ b/scss/_nav.scss
@@ -157,6 +157,36 @@
         text-shadow: none !important;
         color: var(--pwt-color);
     }
+
+    --pwt-transition-time: 0s;
+
+    &.animated {
+        --pwt-transition-time: 0.1s;
+    }
+
+    .pwt-nav-menu-item-arrow {
+        transition: var(--pwt-transition-time);
+        &.expanded {
+            --dir: -180deg;
+            transform: rotateZ(var(--dir));
+        }
+
+        [dir="rtl"] &.expanded {
+          --dir: 180deg;
+        }
+    }
+
+    .pwt-nav-menu-animation-container {
+        transition: var(--pwt-transition-time);
+        overflow: hidden;
+        display: grid;
+        grid-template-rows: 0fr;
+        min-height: fit-content;
+
+        &.expanded {
+            grid-template-rows: 1fr;
+        }
+    }
 }
 
 .pwt-nav-menu-icon {
-- 
2.47.3





  reply	other threads:[~2026-06-19  7:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-19  7:44 [RFC yew-widget-toolkit/yew-widget-toolkit-assets 0/2] Animate navigation drawer menus collapsing/expanding Dominik Csapak
2026-06-19  7:44 ` Dominik Csapak [this message]
2026-06-19  7:44 ` [PATCH yew-widget-toolkit 2/2] widget: navigation drawer: make menu collapsing/expanding animated Dominik Csapak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260619074434.705653-2-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=yew-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal