Skip to content

Commit

Permalink
Use service navigation component for navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
paulrobertlloyd committed Sep 2, 2024
1 parent 5055a41 commit 813ba42
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 182 deletions.
4 changes: 0 additions & 4 deletions components/header/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
// See: https://github.com/alphagov/govuk-design-system/blob/master/src/stylesheets/components/_header.scss

@include govuk-exports("app-header") {
.app-header--full-width-border {
border-bottom: $govuk-border-width-wide solid $govuk-brand-colour;
}

.app-header--no-border {
border-bottom: 0;
}
Expand Down
6 changes: 3 additions & 3 deletions components/header/template.njk
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{%- from "../site-search/macro.njk" import appSiteSearch -%}
{%- if options.navigation -%}
{%- set headerType = "full-width-border" -%}
{%- set headerClasses = " govuk-header--full-width-border" -%}
{% elif layout == "product" or layout == "collection" %}
{%- set headerType = "no-border" -%}
{%- set headerClasses = " app-header--no-border" -%}
{%- endif -%}
<header class="govuk-header app-header{% if headerType %} app-header--{{ headerType }}{% endif %}" role="banner" data-module="govuk-header">
<header class="govuk-header app-header{{ headerClasses }}" role="banner" data-module="govuk-header">
<div class="govuk-header__container govuk-width-container app-header__container">
<div class="govuk-header__logo app-header__logo">
<a href="{{ params.homepageUrl | default("/") }}" class="govuk-header__link govuk-header__link--homepage">
Expand Down
8 changes: 4 additions & 4 deletions layouts/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
{# Components #}
{% from "govuk/components/breadcrumbs/macro.njk" import govukBreadcrumbs %}
{% from "govuk/components/pagination/macro.njk" import govukPagination %}
{% from "govuk/components/service-navigation/macro.njk" import govukServiceNavigation %}

{% from "x-govuk/components/masthead/macro.njk" import xGovukMasthead %}
{% from "x-govuk/components/primary-navigation/macro.njk" import xGovukPrimaryNavigation %}
{% from "x-govuk/components/related-navigation/macro.njk" import xGovukRelatedNavigation %}
{% from "x-govuk/components/sub-navigation/macro.njk" import xGovukSubNavigation %}

Expand Down Expand Up @@ -65,9 +65,9 @@

{% block header %}
{{ appHeader(options.header) }}
{{ xGovukPrimaryNavigation({
visuallyHiddenTitle: options.navigation.visuallyHiddenTitle,
items: options.navigation.items | currentPage(page.url)
{{ govukServiceNavigation({
navigationLabel: options.navigation.visuallyHiddenTitle,
navigation: options.navigation.items | currentPage(page.url)
}) if options.navigation }}
{% endblock %}

Expand Down
2 changes: 1 addition & 1 deletion lib/filters/current-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
module.exports = (array, pageUrl) => {
return array.map((item) => {
item.current =
item.active =
item.href === '/'
? pageUrl === '/' // Page is home page
: pageUrl.startsWith(item.href) // Page is within navigation section
Expand Down
Loading

0 comments on commit 813ba42

Please sign in to comment.