Skip to content

Commit

Permalink
Merge pull request #82 from emulsify-ds/gh-46-drupal-link-attributes
Browse files Browse the repository at this point in the history
GH-46: Fix menu links to show attributes using link
  • Loading branch information
Evan Willhite authored May 28, 2020
2 parents f9e835d + ab78dd5 commit 5d8dc85
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
27 changes: 16 additions & 11 deletions components/02-molecules/menus/_menu-item.twig
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,26 @@
{% endfor %}

{% embed "@atoms/lists/_list-item.twig" with {
"list_item_label": item_label,
"li_base_class": item_base_class|default(menu_class ~ '__item'),
"li_modifiers": item_modifiers,
"li_blockname": item_blockname,
list_item_label: item_label,
li_base_class: item_base_class|default(menu_class ~ '__item'),
li_modifiers: item_modifiers,
li_blockname: item_blockname,
} %}
{% block list_item_content %}
{% include "@atoms/links/link/link.twig" with {
"link_content": item.title,
"link_url": item.url,
"link_base_class": item_base_class|default(menu_class ~ '__link'),
"link_modifiers": item_modifiers,
} %}
{# if drupal #}
{% if directory %}
{{ link(item.title, item.url, bem(item_base_class|default(menu_class ~ '__link'), item_modifiers)) }}
{% else %}
{% include "@atoms/links/link/link.twig" with {
link_content: item.title,
link_url: item.url,
link_base_class: item_base_class|default(menu_class ~ '__link'),
link_modifiers: item_modifiers,
} %}
{% endif %}
{% if item.below %}
<span class="expand-sub"></span>
{{ menus.menu_links(item.below, attributes, menu_level + 1, menu_class, menu_modifiers, menu_blockname, item_base_class, original_item_modifiers, item_blockname) }}
{{ menus.menu_links(item.below, attributes, menu_level + 1, menu_class, menu_modifiers, menu_blockname, item_base_class, original_item_modifiers, item_blockname, directory) }}
{% endif %}
{% endblock %}
{% endembed %}
5 changes: 2 additions & 3 deletions components/02-molecules/menus/_menu.twig
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
We call a macro which calls itself to render the full tree.
@see http://twig.sensiolabs.org/doc/tags/macro.html
#}

{% macro menu_links(items, attributes, menu_level, menu_class, menu_modifiers, menu_blockname, item_base_class, item_modifiers, item_blockname) %}
{% macro menu_links(items, attributes, menu_level, menu_class, menu_modifiers, menu_blockname, item_base_class, item_modifiers, item_blockname, directory) %}
{% import _self as menus %}
{% if items %}

Expand Down Expand Up @@ -58,4 +57,4 @@

{% import _self as menus %}

{{ menus.menu_links(items, attributes, 0, menu_class, menu_modifiers, menu_blockname, item_base_class, item_modifiers, item_blockname) }}
{{ menus.menu_links(items, attributes, 0, menu_class, menu_modifiers, menu_blockname, item_base_class, item_modifiers, item_blockname, directory) }}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
border-bottom: none;
display: inline-block;
font-size: 1.1rem;
padding: $space $space-double $space $space;
padding: $space;
text-transform: none;
position: relative;
width: auto;
Expand All @@ -31,6 +31,7 @@
color: $white;
display: inline-block;
content: '>';
margin-left: 0.5rem;
}

&--sub::after {
Expand Down

0 comments on commit 5d8dc85

Please sign in to comment.