Skip to content

Commit

Permalink
header: Add active state to menu items
Browse files Browse the repository at this point in the history
  • Loading branch information
jennur authored and zzacharo committed Sep 29, 2023
1 parent e1c31b0 commit 7329efe
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
16 changes: 10 additions & 6 deletions assets/less/cds-rdm/collections/menu.overrides
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
}
}

#invenio-nav.ui.menu .ui.menu{
.item:hover{
color: @brandColor
}
}

#invenio-nav.ui.menu {
height: @relative75px;
position: relative;
Expand All @@ -22,6 +16,16 @@
padding: 1rem;
}

.item {
&:hover{
color: @brandColor
}

&.active {
background-color: lighten(@brandColor, 40%);
}
}

.item, .right.menu.item {
padding: 0;

Expand Down
24 changes: 12 additions & 12 deletions templates/semantic-ui/invenio_app_rdm/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@

<div id="rdm-burger-toggle">
<button
id="rdm-burger-menu-icon"
class="ui button transparent"
aria-label="{{ _('Menu') }}"
aria-haspopup="menu"
aria-expanded="false"
aria-controls="invenio-menu"
id="rdm-burger-menu-icon"
class="ui button transparent"
aria-label="{{ _('Menu') }}"
aria-haspopup="menu"
aria-expanded="false"
aria-controls="invenio-menu"
>
<span class="navicon"></span>
</button>
Expand All @@ -61,9 +61,9 @@
class="ui fluid menu borderless mobile-hidden"
>
<button
id="rdm-close-burger-menu-icon"
class="ui button transparent"
aria-label="{{ _('Close menu') }}"
id="rdm-close-burger-menu-icon"
class="ui button transparent"
aria-label="{{ _('Close menu') }}"
>
<span class="navicon"></span>
</button>
Expand Down Expand Up @@ -93,14 +93,14 @@
</div>
</div>
{%- else %}
<div class="{{ ' item active' if item.active and loop.depth == 0 else ' item' }}">
<div class="{{ 'item active' if item.active else 'item' }}">
<a role="menuitem" href="{{ item.url }}">{{ item.text|safe }}</a>
</div>
{%- endif %}
{%- endfor %}

{% for item in current_menu.submenu('actions').children|sort(attribute='order') if item.visible recursive %}
<div class="item">
<div class="{{ 'item active' if item.active else 'item' }}">
<a role="menuitem" href="{{ item.url }}">{{ item.text|safe }}</a>
</div>
{% endfor %}
Expand All @@ -110,7 +110,7 @@
<div class="right menu item">
{%- if config.ACCOUNTS and current_user.is_authenticated %}
{% for item in current_menu.submenu('notifications').children|sort(attribute='order') if item.visible recursive %}
<div class="item inbox">
<div class="{{ 'item active' if item.active else 'item' }} inbox">
<a role="menuitem" href="{{ item.url }}"
aria-label="{{ _("Requests") }}">
<i class="fitted inbox icon inverted" aria-hidden="true"></i>
Expand Down

0 comments on commit 7329efe

Please sign in to comment.