Skip to content

Commit 43595c0

Browse files
Use logo macro in footer
If `rebrand` is set, display the crown logo in the footer above the meta section. Uses the logo macro with the logotype disabled. Add tests for the `rebrand` option of the `govukFooter` macro Adds a `withRebrand` helper to easily add the `rebrand: true` option to existing examples, and tests to check when the crown is displayed. Document `rebrand` Nunjucks macro option Add CHANGELOG entry for the crown addition to the Footer Describes how to enable it both when using the macro and updating the HTML. Reference to the 'feature flag described in the previous section' is copied from the Header update, and will likely need updating when reviewing the CHANGELOG once all the content is present, referring back to the change to the Page template.
1 parent e9912f9 commit 43595c0

5 files changed

Lines changed: 76 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,45 @@ These changes were made in the following pull requests:
6262
- [#5793: Add GOV.UK logo macro](https://github.com/alphagov/govuk-frontend/pull/5793)
6363
- [#5794: Add redesigned header component](https://github.com/alphagov/govuk-frontend/pull/5794)
6464

65+
#### Display the GOV.UK crown in the Footer component
66+
67+
The GOV.UK Footer has been updated to display the GOV.UK crown before its content, as a visual 'full stop' at the end of the page. This can be enabled using the feature flag described in the previous section.
68+
69+
If you're not using the GOV.UK template, but are using the [GOV.UK footer](https://design-system.service.gov.uk/components/footer/) Nunjucks macro, you can display the crown by inserting `rebrand: true` into the component configuration.
70+
71+
```nunjucks
72+
{{ govukFooter({
73+
rebrand: true
74+
}) }}
75+
```
76+
77+
If you're not using our Nunjucks macros, update your footer HTML to adding the following SVG code inside the `<div>` with the `govuk-width-container` class
78+
child of the `<footer>` with `govuk-footer` element.
79+
80+
```html
81+
<svg
82+
focusable="false"
83+
role="presentation"
84+
xmlns="http://www.w3.org/2000/svg"
85+
viewBox="0 0 32 30"
86+
height="30"
87+
width="32"
88+
class="govuk-footer__crown"
89+
>
90+
<g>
91+
<circle cx="10.1" cy="8.8" r="1.8"></circle>
92+
<circle cx="5.2" cy="11.7" r="1.8"></circle>
93+
<circle cx="1.9" cy="16.6" r="1.8"></circle>
94+
<circle cx="16" cy="15.3" r="1.8"></circle>
95+
<circle cx="21.9" cy="8.8" r="1.8"></circle>
96+
<circle cx="26.8" cy="11.7" r="1.8"></circle>
97+
<circle cx="30.1" cy="16.6" r="1.8"></circle>
98+
<circle cx="16" cy="15.3" r="1.8"></circle>
99+
<path d="m16.7 4.9.2-.2 2.3 1.2V2.5l-2.3.7s-.1-.2-.2-.2l.9-2.9h-3.4l.9 2.9s-.2.1-.2.2l-2.3-.7v3.4l2.3-1.2.2.2-1.3 4c-.5 1.4.6 2.9 2.1 2.9s2.5-1.4 2.1-2.9l-1.3-4Zm2 14s-1.7 1.9-2.1 3c1.1 0 2.1-.3 3.2-1.4l-.4 4.3c-1-1.4-2.2-2-2.9-1.9 0 1.5.2 3.4 2.9 3.6 1.9.2 3.4-.8 3.5-1.9.2-1.3-1-2.2-1.9-.8-.7-2.3 1.2-3 2.5-1.6-1-2.2-.9-3.8 1.2-5.4 1.5 2 1.3 3.7-.6 5.5 1.2-.7 3.1 0 2 2.3-.6-1.4-1.8-1.1-2.1.1-.2.9.3 1.9 1.5 2.1.9.2 2.4-.5 3.5-2.9-.6 0-1.2.3-2 .8l1.2-4c.3 1.1.7 1.9 1.1 2.3.3-.8.2-1.4 0-2.7l2.5.9c-1.3 1.8-2.6 4.3-3.7 8.8-3.7-.5-7.9-.8-12.3-.8s-8.6.3-12.3.8c-1.1-4.4-2.3-7-3.7-8.8l2.5-.9c-.2 1.3-.3 1.9 0 2.7.4-.4.8-1.1 1.1-2.3l1.2 4c-.7-.5-1.3-.8-2-.8 1.2 2.5 2.6 3.1 3.5 2.9 1.1-.2 1.7-1.2 1.5-2.1-.3-1.2-1.5-1.5-2.1-.1-1.1-2.3.8-3 2-2.3-1.9-1.9-2.1-3.5-.6-5.5C9 18.4 9 20 8.1 22.2c1.2-1.4 3.2-.7 2.5 1.6-.9-1.4-2.1-.5-1.9.8.2 1.1 1.7 2.1 3.5 1.9 2.7-.2 2.9-2.1 2.9-3.6-.7-.1-1.9.5-2.9 1.9l-.4-4.3c1.1 1.1 2.1 1.4 3.2 1.4-.4-1.2-2.1-3-2.1-3h5.3Z"></path>
100+
</g>
101+
</svg>
102+
```
103+
65104
#### Footer component top border is now consistent with GOV.UK
66105

67106
We've updated the border of the Footer component so it matches the border used on GOV.UK. This will provide a more consistent experience for users as they navigate from GOV.UK to services.

packages/govuk-frontend/src/govuk/components/footer/_index.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
);
2222
}
2323

24+
.govuk-footer__crown {
25+
margin-bottom: govuk-spacing(5);
26+
}
27+
2428
.govuk-footer__link {
2529
@include govuk-link-common;
2630
@include govuk-link-style-text;

packages/govuk-frontend/src/govuk/components/footer/footer.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ params:
105105
type: object
106106
required: false
107107
description: HTML attributes (for example data attributes) to add to the footer component container.
108+
- name: rebrand
109+
type: boolean
110+
required: false
111+
description: If `true`, use the redesigned footer with the GOV.UK crown. Default is `false`.
108112

109113
previewLayout: full-width
110114
accessibilityCriteria: |
@@ -470,3 +474,7 @@ examples:
470474
attributes:
471475
data-attribute: my-attribute
472476
data-attribute-2: my-attribute-2
477+
- name: rebrand
478+
hidden: true
479+
options:
480+
rebrand: true

packages/govuk-frontend/src/govuk/components/footer/template.njk

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
{% from "../../macros/attributes.njk" import govukAttributes -%}
22

3+
{% from "../../macros/logo.njk" import govukLogo -%}
4+
35
<footer class="govuk-footer {%- if params.classes %} {{ params.classes }}{% endif %}"
46
{{- govukAttributes(params.attributes) }}>
57
<div class="govuk-width-container {%- if params.containerClasses %} {{ params.containerClasses }}{% endif %}">
8+
{% if params.rebrand %}
9+
{{- govukLogo({
10+
classes: 'govuk-footer__crown',
11+
rebrand: true,
12+
useLogotype: false
13+
}) }}
14+
{% endif %}
615
{% if params.navigation | length %}
716
<div class="govuk-footer__navigation">
817
{% for nav in params.navigation %}

packages/govuk-frontend/src/govuk/components/footer/template.test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,4 +267,20 @@ describe('footer', () => {
267267
)
268268
})
269269
})
270+
271+
describe('rebrand', () => {
272+
it('Does not show the crown in the footer by default', () => {
273+
const $ = render('footer', examples.default)
274+
275+
const $crown = $('.govuk-footer__crown')
276+
expect($crown).toHaveLength(0)
277+
})
278+
279+
it('Does render the crown if the `rebrand` option is set', () => {
280+
const $ = render('footer', examples.rebrand)
281+
282+
const $crown = $('.govuk-footer__crown')
283+
expect($crown).toHaveLength(1)
284+
})
285+
})
270286
})

0 commit comments

Comments
 (0)