Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overwrite top css to align active menu buttons #2954

Merged
merged 12 commits into from
Nov 30, 2023
30 changes: 15 additions & 15 deletions __snapshots__/layout/_template.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ exports[`base page template matches the favicons block override snapshot 1`] = `



<header class="ons-header " role="banner">
<header class="ons-header" role="banner">



Expand Down Expand Up @@ -377,7 +377,7 @@ exports[`base page template matches the footer block override snapshot 1`] = `



<header class="ons-header " role="banner">
<header class="ons-header" role="banner">



Expand Down Expand Up @@ -641,7 +641,7 @@ exports[`base page template matches the full configuration snapshot 1`] = `



<header class="ons-header ons-header--neutral" role="banner">
<header class="ons-header ons-header--neutral" role="banner">



Expand Down Expand Up @@ -876,8 +876,8 @@ exports[`base page template matches the full configuration snapshot 1`] = `
<ul class="ons-header-service-nav__list">

<li class="ons-header-service-nav__item ons-header-service-nav__item--mobile">






Expand All @@ -889,17 +889,17 @@ exports[`base page template matches the full configuration snapshot 1`] = `
</svg>




Jacky Turner

Jacky Turner
</li>

<li class="ons-header-service-nav__item ons-header-service-nav__item--mobile">


<a href="#0" class="ons-header-service-nav__link">Sign out</a>

<a href="#0" class="ons-header-service-nav__link">Sign out</a>
</li>

</ul>
Expand Down Expand Up @@ -1018,7 +1018,7 @@ exports[`base page template matches the full configuration snapshot 1`] = `



<button type="submit" class="ons-btn ons-u-ml-xs ons-u-d-no ons-js-navigation-button ons-u-d-no@l ons-btn--mobile ons-btn--ghost-dark" aria-label="Toggle main menu" aria-controls="main-nav" aria-expanded="false">
<button type="submit" class="ons-btn ons-u-ml-xs ons-u-d-no ons-navigation-button ons-js-navigation-button ons-u-d-no@l ons-btn--mobile ons-btn--ghost-dark" aria-label="Toggle main menu" aria-controls="main-nav" aria-expanded="false">
<span class="ons-btn__inner"><span class="ons-btn__text">Menu</span>


Expand Down Expand Up @@ -1930,7 +1930,7 @@ exports[`base page template matches the meta block override snapshot 1`] = `



<header class="ons-header " role="banner">
<header class="ons-header" role="banner">



Expand Down Expand Up @@ -2153,7 +2153,7 @@ exports[`base page template matches the social block override snapshot 1`] = `



<header class="ons-header " role="banner">
<header class="ons-header" role="banner">



Expand Down
4 changes: 4 additions & 0 deletions src/components/header/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,8 @@
margin-top: -5px !important;
}
}

.ons-navigation-button.active {
top: 0 !important;
}
}
36 changes: 18 additions & 18 deletions src/components/header/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{% set currentLanguageISOCode = currentLanguage.ISOCode %}
{% endif %}

<header class="ons-header {% if params.classes %} {{ params.classes }}{% endif %}{% if params.variants is not string %}{% for variant in params.variants %} ons-header--{{ variant }}{% endfor %}{% else %} ons-header--{{ params.variants }}{% endif %}" role="banner">
<header class="ons-header{% if params.classes %} {{ params.classes }}{% endif %}{% if params.variants is not string %}{% for variant in params.variants %} ons-header--{{ variant }}{% endfor %}{% else %} ons-header--{{ params.variants }}{% endif %}" role="banner">
{{
onsBrowserBanner({
"lang": currentLanguageISOCode,
Expand Down Expand Up @@ -141,22 +141,22 @@
<ul class="ons-header-service-nav__list">
{% for item in params.serviceLinks.itemsList %}
<li class="ons-header-service-nav__item ons-header-service-nav__item--mobile">
{% if item.iconType %}
{{
onsIcon({
"iconType": item.iconType
})
}}
{% endif %}
{% if item.url %}
<a
href="{{ item.url }}"
class="ons-header-service-nav__link"
{% if item.id %} id="{{ item.id }}"{% endif %}
>{% if item.title %}{{ item.title }}{% elif item.text %}{{ item.text }}{% endif %}</a>
{% else %}
{% if item.title %}{{ item.title }}{% elif item.text %}{{ item.text }}{% endif %}
{% endif %}
{% if item.iconType %}
{{
onsIcon({
"iconType": item.iconType
})
}}
{% endif %}
{% if item.url %}
<a
href="{{ item.url }}"
class="ons-header-service-nav__link"
{% if item.id %} id="{{ item.id }}"{% endif %}
>{% if item.title %}{{ item.title }}{% elif item.text %}{{ item.text }}{% endif %}</a>
{% else %}
{% if item.title %}{{ item.title }}{% elif item.text %}{{ item.text }}{% endif %}
{% endif %}
</li>
{% endfor %}
</ul>
Expand Down Expand Up @@ -250,7 +250,7 @@
{% endif %}
{{ onsButton({
"text": params.navigation.toggleNavigationButton.text,
"classes": "ons-u-ml-xs ons-u-d-no ons-js-navigation-button ons-u-d-no@l",
"classes": "ons-u-ml-xs ons-u-d-no ons-navigation-button ons-js-navigation-button ons-u-d-no@l",
"variants": buttonVariant,
"attributes": {
"aria-label": params.navigation.toggleNavigationButton.ariaLabel | default("Toggle main menu") ,
Expand Down
2 changes: 1 addition & 1 deletion src/components/header/_macro.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ describe('macro: header', () => {

expect(buttonSpy.occurrences[0]).toEqual({
text: 'Menu',
classes: 'ons-u-ml-xs ons-u-d-no ons-js-navigation-button ons-u-d-no@l',
classes: 'ons-u-ml-xs ons-u-d-no ons-navigation-button ons-js-navigation-button ons-u-d-no@l',
variants: ['mobile', 'ghost'],
attributes: {
'aria-label': 'Toggle main menu',
Expand Down
Loading