From ffda718a46d8a1729d662d20403b6198ae6191ff Mon Sep 17 00:00:00 2001 From: Priec Date: Fri, 19 Jun 2026 22:54:15 +0200 Subject: [PATCH] fixed menus now --- assets/views/admin/base.html | 4 +- assets/views/base.html | 6 +- assets/views/partials/profile_menu.html | 90 ++++++++++++-------- assets/views/partials/settings_dropdown.html | 27 +++--- 4 files changed, 74 insertions(+), 53 deletions(-) diff --git a/assets/views/admin/base.html b/assets/views/admin/base.html index 4a0e05f..a2734d2 100644 --- a/assets/views/admin/base.html +++ b/assets/views/admin/base.html @@ -117,8 +117,8 @@ {% block crumb %}{{ t(key="admin-title", lang=lang | default(value='sk')) }}{% endblock crumb %} - -
+ +
{% include "partials/settings_dropdown.html" %}
diff --git a/assets/views/base.html b/assets/views/base.html index 8560376..de365dd 100644 --- a/assets/views/base.html +++ b/assets/views/base.html @@ -115,10 +115,8 @@ class="absolute -right-1 -top-1 inline-flex min-w-4 items-center justify-center rounded-full bg-primary px-1 text-[10px] font-semibold leading-4 text-on-primary dark:bg-primary-dark dark:text-on-primary-dark"> - -
- {% include "partials/settings_dropdown.html" %} -
+ + {% include "partials/settings_dropdown.html" %} diff --git a/assets/views/partials/profile_menu.html b/assets/views/partials/profile_menu.html index bdf2833..a419895 100644 --- a/assets/views/partials/profile_menu.html +++ b/assets/views/partials/profile_menu.html @@ -1,17 +1,16 @@ {# Customer profile dropdown in the storefront navbar. - Penguin UI markup (navbar/with-user-profile.html dropdown + avatar rendered as - avatar-with-initials.html, primary variant, since we have no photo), but with - the same minimal core-Alpine toggle as settings_dropdown.html — plain - open / @click.outside, NOT Penguin's x-trap / $focus keyboard nav (that needs - the Alpine Focus plugin we don't rely on). Self-contained Alpine state. + Proper Penguin UI dropdown: behaviour is the vendored + dropdowns/dropdown-with-icons.html verbatim (isOpen / openedWithKeyboard, + x-trap + $focus keyboard nav, x-cloak x-show, @click.outside). Trigger is the + round initials avatar (avatar-with-initials.html, primary variant). Menu items + are our account links. - IMPORTANT: the dropdown
diff --git a/assets/views/partials/settings_dropdown.html b/assets/views/partials/settings_dropdown.html index b9308f9..6a5da1b 100644 --- a/assets/views/partials/settings_dropdown.html +++ b/assets/views/partials/settings_dropdown.html @@ -1,18 +1,22 @@ {# Settings dropdown (language + theme). Shared by base.html and admin/base.html to kill the former ~100-line copy-paste duplication. - Adapted from the vendored Penguin UI component - penguinui-components/dropdowns/dropdown-with-click.html: Penguin's dropdown - menu container + item treatment. Deviations: kept our gear icon-only trigger - and our core-Alpine open / @click.outside toggle (upstream's x-trap / $focus - need the Alpine Focus plugin, which we don't bundle); item hover uses - bg-primary/5 to stay consistent with the rest of our Penguin-ified UI. + Proper Penguin UI dropdown: behaviour is the vendored + dropdowns/dropdown-with-icons.html verbatim (isOpen / openedWithKeyboard, + x-trap + $focus keyboard nav, x-cloak x-show, @click.outside). Trigger is our + gear icon-only button; content is the language form + theme toggle. Needs the + Alpine Focus plugin (loaded in base.html) for x-trap / $focus. - The host template provides the wrapper -
- so it controls its own positioning (e.g. ml-auto in admin). #} -{{ ui::icon_button(aria_label=t(key='settings', lang=lang | default(value='sk')), attrs='@click="open = !open" :aria-expanded="open"', icon='') }} -
+{{ ui::icon_button(aria_label=t(key='settings', lang=lang | default(value='sk')), attrs='x-on:click="isOpen = ! isOpen" x-on:keydown.space.prevent="openedWithKeyboard = true" x-on:keydown.enter.prevent="openedWithKeyboard = true" x-on:keydown.down.prevent="openedWithKeyboard = true" x-bind:aria-expanded="isOpen || openedWithKeyboard" aria-haspopup="true"', icon='') }} +
+