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

Update the menu CSS to ensure the columns are consistent width, and update the macro to ensure both text and link are present before outputting a link #63

Draft
wants to merge 3 commits into
base: main-menu-CMS-169
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 14 additions & 26 deletions cms/jinja2/component_overrides/header/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,14 @@
<div class="ons-container">
<ul class="ons-grid ons-grid-flex-gap ons-grid-flex-gap--40 navigation__key-links ons-list ons-list--bare">
{% for item in params.navLinks.keyLinksList %}
{# In the new header, nav items can have text and no link - later we would want to test that both are present before outputting an li #}
{% if item.text %}
{% if item.text and item.url %}
<li class="ons-grid__col ons-col-4@m ons-u-mb-no">
{% if item.url %}

<h2 class="ons-u-fs-s--b ons-u-mb-no navigation__heading avigation__heading--key-link">
<a href="{{ item.url }}" class="navigation__link">
{% endif %}
<h2 class="ons-u-fs-s--b ons-u-mb-no navigation__heading avigation__heading--key-link">{{ item.text }}</h2>
{% if item.url %}
{{ item.text }}
</a>
{% endif %}
</h2>
{% if item.description %}
<p class="ons-u-fs-s ons-u-mb-no navigation__paragraph navigation__paragraph--key-link">{{ item.description }}</p>
{% endif %}
Expand All @@ -176,39 +174,29 @@
{% for item in params.navLinks.itemsList %}
<li class="ons-grid__col ons-col-4@m ons-u-mb-no">
{% for link in item.linksList %}
{# In the new header, nav items can have text and no link - later we would want to test that both are present before outputting a heading link #}
{% if link.text %}
{% if link.url %}
{% if link.text and link.url %}
<h2 class="ons-u-fs-s--b navigation__heading">
<a
href="{{ link.url }}"
class="ons-header-service-nav__link navigation__link"
>
{% endif %}
<h2 class="ons-u-fs-s--b navigation__heading">
{{ link.text }}
</h2>
{% if link.url %}
</a>
{% endif %}
</h2>
{% endif %}
{% if link.children %}
<ul class="ons-list ons-list--bare navigation__child-list">
{% for child in link.children %}
{# In the new header, nav items can have text and no link - later we would want to test that both are present before outputting an li #}
{% if child.text %}
{% if child.text and child.url %}
<li class="ons-u-mb-no">
{% if child.url %}
<a
href="{{ child.url }}"
class="ons-header-service-nav__link navigation__link"
>
{% endif %}
<a
href="{{ child.url }}"
class="ons-header-service-nav__link navigation__link"
>
<p class="ons-u-fs-s navigation__paragraph">
{{ child.text }}
</p>
{% if child.url %}
</a>
{% endif %}
</a>
</li>
{% endif %}
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,14 @@ Adds custom gap values to match the designs
}
/* stylelint-enable selector-class-pattern */
}

/* stylelint-disable selector-class-pattern */
// Note that in the design system, this needs to be defined for all column and gap variations
.ons-col-4\@m {
@include media-query('m') {
max-width: calc(33.333333333% - rem-sizing(40));
width: calc(33.333333333% - rem-sizing(40));
flex-basis: calc(33.333333333% - rem-sizing(40));
}
}
/* stylelint-enable selector-class-pattern */