diff --git a/CHANGELOG.md b/CHANGELOG.md index ac779ef..bf469d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Added - [GOV.UK Frontend v5.6.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.6.0) support +- [Service navigation component](https://design-system.service.gov.uk/components/service-navigation/) ## [3.2.0](https://github.com/LandRegistry/govuk-frontend-jinja/releases/tag/3.2.0) - 27/08/2024 diff --git a/govuk_frontend_jinja/templates/components/service-navigation/macro.html b/govuk_frontend_jinja/templates/components/service-navigation/macro.html new file mode 100644 index 0000000..7419c02 --- /dev/null +++ b/govuk_frontend_jinja/templates/components/service-navigation/macro.html @@ -0,0 +1,104 @@ +{% macro govukServiceNavigation(params) %} +{% from "govuk_frontend_jinja/macros/attributes.html" import govukAttributes %} + +{%- set menuButtonText = params.menuButtonText | default("Menu", true) -%} +{%- set navigationId = params.navigationId | default("navigation", true) %} + +{%- set commonAttributes %} +class="govuk-service-navigation {%- if params.classes %} {{ params.classes }}{% endif %}" +data-module="govuk-service-navigation" +{{- govukAttributes(params.attributes) }} +{% endset -%} + +{%- set innerContent %} +
+ + {# Slot: start #} + {%- if params.slots and params.slots.start %}{{ params.slots.start | safe }}{% endif -%} + +
+ {# Service name #} + {% if params.serviceName %} + + {% if params.serviceUrl %} + + {{ params.serviceName }} + + {% else %} + + {{- params.serviceName -}} + + {% endif %} + + {% endif %} + + {# Navigation #} + {% if params.navigation | length or params.slots and (params.slots.navigationStart or params.slots.navigationEnd) %} + + {% endif %} +
+ + {# Slot: end #} + {%- if params.slots and params.slots.end %}{{ params.slots.end | safe }}{% endif -%} + +
+{% endset -%} + +{# If a service name is included, we use a
element with an + aria-label to create a containing landmark region. Otherwise, the