Skip to content

Commit

Permalink
Merge pull request #346 from torchbox/feature/twe-17-primary-nav-and-…
Browse files Browse the repository at this point in the history
…header

TWE-17 | FE | Primary nav and header
  • Loading branch information
albinazs authored Jan 21, 2025
2 parents 4de43d9 + 9880c5d commit 315ee0b
Show file tree
Hide file tree
Showing 20 changed files with 296 additions and 498 deletions.
Original file line number Diff line number Diff line change
@@ -1,35 +1,16 @@
{% load wagtailcore_tags %}

{% comment %}
The `child_display` has 3 possible values:
- hide_children - do not show a subnavigation
- show_up_to_level1 - show level one child pages
- show_up_to_level2 - show level one and level two child pages
{% endcomment %}

{% for item in primarynav %}
{% with children=item.value.page.get_children.live.public.in_menu.specific child_display=item.value.child_display_behaviour %}
<li class="primary-nav-mobile__item {% if children and child_display != 'hide_children' %}primary-nav-mobile__item--is-parent{% endif %}">
{% with link=item.value %}
<a
class="primary-nav-mobile__link {% if children and child_display != 'hide_children' %}primary-nav-mobile__link--has-children{% else %}primary-nav-mobile__link--no-children{% endif %}"
{% if children and child_display != 'hide_children' %}
data-open-subnav aria-haspopup="true" aria-expanded="false"
{% endif %}
href="{% if link.page %}{% pageurl link.page %}{% elif link.external_link %}{{ link.external_link }}{% endif %}"
{% if forloop.last %}data-last-menu-item-mobile{% endif %}
>
<span class="primary-nav-mobile__text">{{ link.text }}</span>
{% if children and child_display != 'hide_children' %}
{# mobile arrow #}
{% include "patterns/atoms/icons/icon.html" with name="arrow" classname="primary-nav-mobile__icon-mobile" only %}
{% endif %}
</a>

{% if children and child_display != 'hide_children' %}
{% include "patterns/navigation/components/includes/subnav-menu-mobile.html" with links=children parent=link only %}
{% endif %}
{% endwith %}
</li>
{% endwith %}
<li class="primary-nav-mobile__item">
{% with link=item.value %}
<a
class="primary-nav-mobile__link"
href="{% if link.page %}{% pageurl link.page %}{% elif link.external_link %}{{ link.external_link }}{% endif %}"
{% if forloop.last %}data-last-menu-item-primary-mobile{% endif %}
>
<span class="primary-nav-mobile__text">{{ link.text }}</span>
</a>
{% endwith %}
</li>
{% endfor %}

Original file line number Diff line number Diff line change
Expand Up @@ -3,115 +3,25 @@ context:
primarynav:
- item:
value:
child_display_behaviour: 'show_up_to_level2'
text: Services
url: '#'
page:
get_children:
live:
public:
in_menu:
specific:
- nav_text: Strategy and consultancy
get_children:
live:
public:
in_menu:
specific:
- nav_text: AI strategy
- nav_text: Content strategy and IA
- nav_text: Digital transformation
- nav_text: Innovation strategy
- nav_text: Product strategy
- nav_text: Service design
- nav_text: Technical architecture design
- nav_text: User research
- nav_text: Digital marketing
get_children:
live:
public:
in_menu:
specific:
- nav_text: Asset and campaign creative
- nav_text: Digital marketing training
- nav_text: Data and measurement
- nav_text: Digital marketing training
- nav_text: Email marketing
- nav_text: Google Ad Grants Management
- nav_text: Pay-per-click management
- nav_text: Search Engine Optimisation (SEO)
- nav_text: Social media management
- nav_text: Wagtail CMS services
get_children:
live:
public:
in_menu:
specific:
- nav_text: Developer support
- nav_text: Staff augmentation
- nav_text: Training and consultancy
- nav_text: Digital product development
- item:
value:
child_display_behaviour: 'show_up_to_level1'
text: Sectors
url: '#'
page:
get_children:
live:
public:
in_menu:
specific:
- nav_text: Charities
get_children:
live:
public:
in_menu:
specific:
- nav_text: Charity sub 1
- nav_text: Charity sub 2
- nav_text: Charity sub 2
- nav_text: Higher Education
- nav_text: Government
- item:
value:
child_display_behaviour: 'show_up_to_level1'
text: About
url: '#'
page:
get_children:
live:
public:
in_menu:
specific:
- nav_text: Culture
get_children:
live:
public:
in_menu:
specific:
- nav_text: Culture child one
- nav_text: Culture child two
- nav_text: Culture child three
- nav_text: Jobs
get_children:
live:
public:
in_menu:
specific:
- nav_text: Jobs child one
- nav_text: Jobs child two
- nav_text: Jobs child three
- item:
value:
child_display_behaviour: 'hide-children'
text: Thinking
url: '#'
- item:
value:
child_display_behaviour: 'hide-children'
text: Work
url: '#'

tags:
pageurl:
'link.url':
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,14 @@
{% load wagtailcore_tags %}

{% comment %}
The `child_display` has 3 possible values:
- hide_children - do not show a subnavigation
- show_up_to_level1 - show level one child pages
- show_up_to_level2 - show level one and level two child pages
{% endcomment %}

{% for item in primarynav %}
{% with children=item.value.page.get_children.live.public.in_menu.specific child_display=item.value.child_display_behaviour %}
<li class="primary-nav-desktop__item {% if children and child_display != 'hide_children' %}primary-nav-desktop__item--is-parent{% endif %}"
{% if children and child_display != 'hide_children' %}data-has-subnav{% endif %}
>
{% with link=item.value %}
<a
class="primary-nav-desktop__link {% if children and child_display != 'hide_children' %}primary-nav-desktop__link--has-children{% else %}primary-nav-desktop__link--no-children{% endif %}"
{% if children and child_display != 'hide_children' %}
data-open-subnav aria-haspopup="true" aria-expanded="false"
{% endif %}
href="{% if link.page %}{% pageurl link.page %}{% elif link.external_link %}{{ link.external_link }}{% endif %}"
>
<span class="primary-nav-desktop__text">{{ link.text }}</span>
{% if children and child_display != 'hide_children' %}
{# desktop arrows #}
<div class="primary-nav-desktop__icon-wrapper">
{% include "patterns/atoms/icons/icon.html" with name="chevron" classname="primary-nav-desktop__icon-closed" only %}
{% include "patterns/atoms/icons/icon.html" with name="arrow-short" classname="primary-nav-desktop__icon-hover" only %}
{% include "patterns/atoms/icons/icon.html" with name="arrow-tall" classname="primary-nav-desktop__icon-open" only %}
</div>
{% endif %}
</a>
{% if children and child_display == 'show_up_to_level1' %}
{# if we are only showing up to level 1, show a small dropdown #}
{% include "patterns/navigation/components/includes/subnav-menu-mini.html" with links=children last=forloop.last revcounter=forloop.revcounter only %}
{% elif children and child_display == 'show_up_to_level2' %}
{# if we are showing level 1 and level 2 children, show a wide dropdown #}
{% include "patterns/navigation/components/includes/subnav-menu.html" with links=children number=children|length only %}
{% endif %}
{% endwith %}
</li>
{% endwith %}
<li class="primary-nav-desktop__item">
{% with link=item.value %}
<a
class="primary-nav-desktop__link"
href="{% if link.page %}{% pageurl link.page %}{% elif link.external_link %}{{ link.external_link }}{% endif %}"
>
{{ link.text }}
</a>
{% endwith %}
</li>
{% endfor %}
Original file line number Diff line number Diff line change
@@ -1,117 +1,26 @@
context:
children: True
primarynav:
- item:
value:
child_display_behaviour: 'show_up_to_level2'
text: Services
external_url: '#'
page:
get_children:
live:
public:
in_menu:
specific:
- nav_text: Strategy and consultancy
get_children:
live:
public:
in_menu:
specific:
- nav_text: AI strategy
- nav_text: Content strategy and IA
- nav_text: Digital transformation
- nav_text: Innovation strategy
- nav_text: Product strategy
- nav_text: Service design
- nav_text: Technical architecture design
- nav_text: User research
- nav_text: Digital marketing
get_children:
live:
public:
in_menu:
specific:
- nav_text: Asset and campaign creative
- nav_text: Digital marketing training
- nav_text: Data and measurement
- nav_text: Digital marketing training
- nav_text: Email marketing
- nav_text: Google Ad Grants Management
- nav_text: Pay-per-click management
- nav_text: Search Engine Optimisation (SEO)
- nav_text: Social media management
- nav_text: Wagtail CMS services
get_children:
live:
public:
in_menu:
specific:
- nav_text: Developer support
- nav_text: Staff augmentation
- nav_text: Training and consultancy
- nav_text: Digital product development
- item:
value:
child_display_behaviour: 'show_up_to_level1'
text: Sectors
external_url: '#'
page:
get_children:
live:
public:
in_menu:
specific:
- nav_text: Charities
get_children:
live:
public:
in_menu:
specific:
- nav_text: Charity sub 1
- nav_text: Charity sub 2
- nav_text: Charity sub 2
- nav_text: Higher Education
- nav_text: Government
- item:
value:
child_display_behaviour: 'show_up_to_level1'
text: About
external_url: '#'
page:
get_children:
live:
public:
in_menu:
specific:
- nav_text: Culture
get_children:
live:
public:
in_menu:
specific:
- nav_text: Culture child one
- nav_text: Culture child two
- nav_text: Culture child three
- nav_text: Jobs
get_children:
live:
public:
in_menu:
specific:
- nav_text: Jobs child one
- nav_text: Jobs child two
- nav_text: Jobs child three
- item:
value:
child_display_behaviour: 'hide-children'
text: Thinking
external_link: '#'
- item:
value:
child_display_behaviour: 'hide-children'
text: Work
external_link: '#'

tags:
pageurl:
'link.url':
Expand Down
Loading

0 comments on commit 315ee0b

Please sign in to comment.