Skip to content

Commit

Permalink
Details for mew menu rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
andmor- committed Sep 11, 2024
1 parent cdfdbf9 commit 7d1cc0c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
11 changes: 10 additions & 1 deletion scss/modules/navbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
}

.dropdown-menu {
padding: 20px 15px;
padding: 20px 18px;
z-index: 499;

.dropdown-item:hover,
Expand Down Expand Up @@ -461,3 +461,12 @@
}
}
}

.menu-title {
font-size: 1.125rem;
font-weight: 600;
margin-left: -5px;
margin-top: -0.25rem;
margin-bottom: 0.2rem;
border-bottom: $subtle-grey-01 solid 1px;
}
14 changes: 7 additions & 7 deletions templates/navigation/menu--main-menu-v3.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,20 @@
We call a macro which calls itself to render the full tree.
@see http://twig.sensiolabs.org/doc/tags/macro.html
#}
{{ menus.menu_links(items, attributes, 0) }}
{{ menus.menu_links(items, attributes, 0, menu_name) }}

{% macro menu_links(items, attributes, menu_level) %}
{% macro menu_links(items, attributes, menu_level, current_item) %}
{% import _self as menus %}
{% if items %}
{% if menu_level == 0 %}
<ul{{ attributes.addClass('nav navbar-nav')|without('id') }}>
{% else %}
<ul class="dropdown-menu">
{% if menu_level == 1 %}
<li class="menu-title" >{{ link(current_item.title, current_item.url, {'class': link_classes}) }}</li>
{% endif %}
{% endif %}

{% for item in items %}
{%
set classes = [
Expand All @@ -44,9 +48,6 @@
item.below ? 'dropdown',
]
%}
{% if menu_level == 1 %}
<li class="menu-title" >item.title</li>
{% else %}
<li{{ item.attributes.addClass(classes) }}>
{%
set link_classes = [
Expand All @@ -59,12 +60,11 @@
%}
{% if item.below %}
{{ link(item.title, item.url, {'class': link_classes, 'data-bs-toggle': 'dropdown', 'aria-expanded': 'false', 'aria-haspopup': 'true' }) }}
{{ menus.menu_links(item.below, attributes, menu_level + 1) }}
{{ menus.menu_links(item.below, attributes, menu_level + 1, item) }}
{% else %}
{{ link(item.title, item.url, {'class': link_classes}) }}
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
Expand Down

0 comments on commit 7d1cc0c

Please sign in to comment.