From b6485c6eef1480a0da039fd2cb5aa2241da80c59 Mon Sep 17 00:00:00 2001 From: Frankie Roberto Date: Wed, 26 Jun 2024 21:35:02 +0100 Subject: [PATCH 1/5] Make copyright statement settable via params This de-duplicates 2 areas where the copyright statement is set (depending on the number of columns of links), and also allows the copyright text to be set using `params.copyright` on the Nunjucks macro. --- app/components/footer/custom-copyright.njk | 34 ++++++++++++++++++++++ app/pages/examples.njk | 1 + packages/components/footer/README.md | 1 + packages/components/footer/template.njk | 6 ++-- 4 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 app/components/footer/custom-copyright.njk diff --git a/app/components/footer/custom-copyright.njk b/app/components/footer/custom-copyright.njk new file mode 100644 index 000000000..287316531 --- /dev/null +++ b/app/components/footer/custom-copyright.njk @@ -0,0 +1,34 @@ +{% set html_style = 'background-color: #f0f4f5;' %} +{% set title = 'Footer (default)' %} +{% from 'components/footer/macro.njk' import footer %} +{% extends 'layout.njk' %} + +{% block body %} + + {{ footer({ + copyright: "© City NHS Foundation Trust", + "links": [ + { + "URL": "#", + "label": "Accessibility statement" + }, + { + "URL": "#", + "label": "Contact us" + }, + { + "URL": "#", + "label": "Cookies" + }, + { + "URL": "#", + "label": "Privacy policy" + }, + { + "URL": "#", + "label": "Terms and conditions" + } + ] + })}} + +{% endblock %} diff --git a/app/pages/examples.njk b/app/pages/examples.njk index 6473c4dd4..107616557 100644 --- a/app/pages/examples.njk +++ b/app/pages/examples.njk @@ -72,6 +72,7 @@
  • Fieldset with inputs
  • Footer (default)
  • Footer (columns)
  • +
  • Footer (custom copyright statement)
  • Header (default)
  • Header with navigation
  • Header with search
  • diff --git a/packages/components/footer/README.md b/packages/components/footer/README.md index 34e016729..968fbfc09 100644 --- a/packages/components/footer/README.md +++ b/packages/components/footer/README.md @@ -282,6 +282,7 @@ The footer Nunjucks macro takes the following arguments: | **linksColumn3** | array | No | Array of third column of navigation items for use in the footer. | | **linksColumn3.[].url** | string | No | The href of a navigation item in the third column of the footer. | | **linksColumn3.[].label** | string | No | The label of a navigation item in the third column of the footer. | +| **copyright** | string | No | Optional text for the copyright notice in the footer. Defaults to '© NHS England' | | **classes** | string | No | Optional additional classes to add to the footer container. Separate each class with a space. | | **attributes** | object | No | Any extra HTML attributes (for example data attributes) to add to the footer container. | | **copyright** | string | No | The label for the copyright notice in the footer. | diff --git a/packages/components/footer/template.njk b/packages/components/footer/template.njk index 903485217..572361903 100644 --- a/packages/components/footer/template.njk +++ b/packages/components/footer/template.njk @@ -1,3 +1,5 @@ +{%- set copyrightText = params.copyright if params.copyright else '© NHS England' -%} +