feat: group the sidebar, add a settings hub and move account actions to a header user menu

This commit is contained in:
fromme committed 2026-11-12 11:13:30 +01:00
1 parent acd8e78e55
commit 7095456d36
16 files changed
+487 -477

No files matched your search

+13 -9
View File
@@ -3,7 +3,7 @@
{% block list %}
{% if item.hasChildren and options.depth is not same as(0) and item.displayChildren %}
{% if item.level == 0 %}
<div class="min-h-full flex grow flex-col gap-y-5 lg:border-r border-gray-200 bg-white md:pr-6">
<div class="min-h-full flex grow flex-col gap-y-5">
<nav class="flex flex-1 flex-col">
<ul role="list" class="space-y-1">
{{ block('children') }}
@@ -19,7 +19,10 @@
{% endblock %}
{% block item %}
{% if item.displayed %}
{% if item.displayed and item.extras.heading is defined %}
{# the heading of a group of items, see AbstractMenuBuilder::addHeading() #}
<li class="px-2 pt-5 pb-1 text-[11px] font-semibold uppercase tracking-wide text-muted">{{ item.label|raw }}</li>
{% elseif item.displayed %}
<li>
{%- if item.hasChildren and item.displayChildren %}
<div {{ stimulus_controller('sidebar-menu', {'expanded': matcher.isAncestor(item)}, {'closed': 'hidden', 'iconClosed': 'text-gray-400', 'iconExpanded': 'text-gray-500'}) }}>
@@ -41,9 +44,10 @@
{% import _self as knp_menu %}
<a href="{{ item.uri }}"
class="{{ html_classes('', {
'group flex gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold text-gray-700 hover:bg-gray-50': item.level == 1,
'block rounded-md py-2 pr-2 pl-9 text-sm leading-6 text-gray-700 hover:bg-gray-50': item.level > 1,
'bg-gray-50': matcher.isCurrent(item) or matcher.isAncestor(item)
'group flex gap-x-3 p-2 text-sm leading-6 font-semibold': item.level == 1,
'block py-2 pr-2 pl-9 text-sm leading-6': item.level > 1,
'text-ink hover:bg-white/60 hover:text-brand': not (matcher.isCurrent(item) or matcher.isAncestor(item)),
'bg-white text-brand': matcher.isCurrent(item) or matcher.isAncestor(item)
}) }}"
{{ knp_menu.attributes(item.linkAttributes) }}>
{{ block('label') }}
@@ -57,14 +61,14 @@
{{ stimulus_action('sidebar-menu', 'toggleSubmenu') }}
{{ stimulus_target('sidebar-menu', 'button') }}
{{ knp_menu.attributes(item.linkAttributes) }}
class="{{ html_classes('hover:bg-gray-50 flex items-center w-full text-left rounded-md p-2 gap-x-3 text-sm leading-6 font-semibold text-gray-700', { 'bg-gray-50': matcher.isAncestor(item) }) }}"
class="{{ html_classes('hover:bg-white/60 hover:text-brand flex items-center w-full text-left p-2 gap-x-3 text-sm leading-6 font-semibold', { 'text-brand': matcher.isAncestor(item), 'text-ink': not matcher.isAncestor(item) }) }}"
aria-expanded="false">
{{ block('label') }}
</button>
{% elseif item.extras.divider is defined %}
<hr class="my-4 h-px bg-gray-200">
<hr class="my-4 h-px border-line">
{% else %}
<div class="hover:bg-gray-50 group flex gap-x-3 rounded-md p-2 text-sm leading-5 font-semibold text-gray-700"
<div class="hover:bg-white/60 group flex gap-x-3 p-2 text-sm leading-5 font-semibold text-ink"
role="button">
{{ block('label') }}
</div>
@@ -73,7 +77,7 @@
{% block label -%}
{% if item.extras.icon is defined -%}
{{ icon(item.extras.icon, 'h-5 w-5 shrink-0 text-gray-400') -}}
{{ icon(item.extras.icon, 'h-5 w-5 shrink-0 ' ~ ((matcher.isCurrent(item) or matcher.isAncestor(item)) ? 'text-brand' : 'text-muted')) -}}
<span class="flex-1">{{ item.label|raw }}</span>
{%- else -%}
{{ item.label|raw }}