Skip to content

Commit

Permalink
Enhancement/1826/header footer param naming (#2741)
Browse files Browse the repository at this point in the history
* mid refactor

* renamed parameter, but allowed use of old parameter - title. This is to avoid BC
  • Loading branch information
willcAND authored Jul 24, 2023
1 parent 9ca9a93 commit ab218c1
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/components/header/_macro-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
| --------- | ------ | -------- | --------------------------------------------------------------------- |
| classes | string | false | Classes to add to the list item element |
| url | string | true | The URL for the HTML `href` attribute for the path to the linked page |
| title | string | true | The text label for the link |
| text | string | true | The text label for the link |
| id | string | false | The HTML `id` of the link |
| ariaLabel | string | false | The `aria-label` for the item. |

Expand Down
8 changes: 4 additions & 4 deletions src/components/header/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@
href="{{ item.url }}"
class="ons-header-service-nav__link"
{% if item.id %} id="{{ item.id }}"{% endif %}
>{{ item.title }}</a>
>{% if item.title %}{{ item.title }}{% elif item.text %}{{ item.text }}{% endif %}</a>
{% else %}
{{ item.title }}
{% if item.title %}{{ item.title }}{% elif item.text %}{{ item.text }}{% endif %}
{% endif %}
</li>
{% endfor %}
Expand Down Expand Up @@ -153,9 +153,9 @@
href="{{ item.url }}"
class="ons-header-service-nav__link"
{% if item.id %} id="{{ item.id }}"{% endif %}
>{{ item.title }}</a>
>{% if item.title %}{{ item.title }}{% elif item.text %}{{ item.text }}{% endif %}</a>
{% else %}
{{ item.title }}
{% if item.title %}{{ item.title }}{% elif item.text %}{{ item.text }}{% endif %}
{% endif %}
</li>
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@
"currentPath": '#home',
"itemsList": [
{
"title": 'Home',
"text": 'Home',
"url": '#home'
},
{
"title": 'Guidance',
"text": 'Guidance',
"url": '#0'
},
{
"title": 'Foundations',
"text": 'Foundations',
"url": '#0'
},
{
"title": 'Components',
"text": 'Components',
"url": '#0'
},
{
"title": 'Patterns',
"text": 'Patterns',
"url": '#0'
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
},
"itemsList": [
{
"title": "Help",
"text": "Help",
"url": "#0"
},
{
"title": "My Account",
"text": "My Account",
"url": "#0"
},
{
"title": "Sign out",
"text": "Sign out",
"url": "#0"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@
"currentPageTitle": 'Design system',
"itemsList": [
{
"title": 'Service standard',
"text": 'Service standard',
"url": '#0'
},
{
"title": 'Design system',
"text": 'Design system',
"url": '#design-system'
},
{
"title": 'Accessibility',
"text": 'Accessibility',
"url": '#0'
},
{
"title": 'Brand guidelines',
"text": 'Brand guidelines',
"url": '#0'
},
{
"title": 'Content style guide',
"text": 'Content style guide',
"url": '#0'
}
],
Expand All @@ -46,19 +46,19 @@
"ariaLabel": 'Section menu',
"itemsList": [
{
"title": 'Guidance',
"text": 'Guidance',
"url": '#0'
},
{
"title": 'Foundations',
"text": 'Foundations',
"url": '#0'
},
{
"title": 'Components',
"text": 'Components',
"url": '#0'
},
{
"title": 'Patterns',
"text": 'Patterns',
"url": '#patterns',
"sections": [
{
Expand Down
4 changes: 2 additions & 2 deletions src/components/header/example-header-internal.njk
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
},
"itemsList": [
{
"title": "Jacky Turner",
"text": "Jacky Turner",
"iconType": 'person'
},
{
"title": "Sign out",
"text": "Sign out",
"url": "#0"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
},
"itemsList": [
{
"title": "Help",
"text": "Help",
"url": "#0"
},
{
"title": "My Account",
"text": "My Account",
"url": "#0"
},
{
"title": "Sign out",
"text": "Sign out",
"url": "#0"
}
]
Expand All @@ -38,15 +38,15 @@
"currentPageTitle": 'Design system',
"itemsList": [
{
"title": 'Menu item 1',
"text": 'Menu item 1',
"url": '#0'
},
{
"title": 'Menu item 2',
"text": 'Menu item 2',
"url": '#menu-item-2'
},
{
"title": 'Menu item 3',
"text": 'Menu item 3',
"url": '#0'
}
],
Expand Down
8 changes: 4 additions & 4 deletions src/components/navigation/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<ul class="ons-navigation__list">
{% for item in params.navigation.itemsList %}
<li class="ons-navigation__item {{ item.classes }}{{ ' ons-navigation__item--active' if (item.url == params.navigation.currentPath) or (params.navigation.currentPath is not string and item.url in params.navigation.currentPath) }}">
<a class="ons-navigation__link" href="{{ item.url }}" {% if item.id %}id="{{ item.id }}" {% endif %}{% if item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %}>{{ item.title }}</a>
<a class="ons-navigation__link" href="{{ item.url }}" {% if item.id %}id="{{ item.id }}" {% endif %}{% if item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %}>{% if item.title %}{{ item.title }}{% elif item.text %}{{ item.text }}{% endif %}</a>
</li>
{% endfor %}
</ul>
Expand All @@ -55,7 +55,7 @@
<ul class="ons-navigation__list ons-navigation__list">
{% for item in params.navigation.subNavigation.itemsList %}
<li class="ons-navigation__item {{ item.classes }}{{ ' ons-navigation__item--active' if (item.url == params.navigation.currentPath) or (params.navigation.currentPath is not string and item.url in params.navigation.currentPath) }}">
<a class="ons-navigation__link ons-navigation__link" href="{{ item.url }}" {% if item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %} {% if item.id %}id="{{ item.id }}" {% endif %}>{{ item.title }}</a>
<a class="ons-navigation__link ons-navigation__link" href="{{ item.url }}" {% if item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %} {% if item.id %}id="{{ item.id }}" {% endif %}>{% if item.title %}{{ item.title }}{% elif item.text %}{{ item.text }}{% endif %}</a>
</li>
{% endfor %}
</ul>
Expand All @@ -81,14 +81,14 @@
</li>
{% for item in params.navigation.subNavigation.itemsList %}
<li class="ons-navigation__item {{ ' ons-navigation__item--active' if (item.url == params.navigation.subNavigation.currentPath) or (item.url == params.navigation.currentPath) or (params.navigation.currentPath is not string and item.url in params.navigation.currentPath) }}">
<a class="ons-navigation__link" href="{{ item.url }}" {% if item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %} {% if item.id %}id="{{ item.id }}--mobile" {% endif %}>{{ item.title }}</a>
<a class="ons-navigation__link" href="{{ item.url }}" {% if item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %} {% if item.id %}id="{{ item.id }}--mobile" {% endif %}>{% if item.title %}{{ item.title }}{% elif item.text %}{{ item.text }}{% endif %}</a>
{% if item.sections %}
{% for section in item.sections %}
{% if section.sectionTitle %}<h3 class="ons-navigation__list-header">{{ section.sectionTitle }}</h3>{% endif %}
<ul class="ons-navigation__list ons-navigation__list--child ons-list--dashed ons-u-ml-s ons-u-mt-xs">
{% for child in section.children %}
<li class="ons-navigation__item ons-list__item {{ ' ons-navigation__item--active' if (child.url == params.navigation.currentPath) or (params.navigation.currentPath is not string and child.url in params.navigation.currentPath) }}">
<a class="ons-navigation__link ons-navigation__link--section" href="{{ child.url }}" {% if child.ariaLabel %}aria-label="{{ child.ariaLabel }}" {% endif %} {% if child.id %}id="{{ child.id }}" {% endif %}>{{ child.title }}</a>
<a class="ons-navigation__link ons-navigation__link--section" href="{{ child.url }}" {% if child.ariaLabel %}aria-label="{{ child.ariaLabel }}" {% endif %} {% if child.id %}id="{{ child.id }}" {% endif %}>{% if child.title %}{{ child.title }}{% elif child.text %}{{ child.text }}{% endif %}</a>
</li>
{% endfor %}
</ul>
Expand Down

0 comments on commit ab218c1

Please sign in to comment.