Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update footer to take licence text and copyright text #1314

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/components/footer/footer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,28 @@ params:
type: object
required: false
description: HTML attributes (for example data attributes) to add to the anchor in the footer navigation section.
- name: licence
type: object
required: false
description: License Text
params:
- name: html
type: string
description: HTML licence section of the footer.
- name: text
type: string
description: Text licence section of the footer.
- name: copyright
type: object
required: false
description: License Text
params:
- name: html
type: string
description: HTML copyright section of the footer.
- name: text
type: string
description: Text copyright section of the footer.
- name: containerClasses
type: string
required: false
Expand Down Expand Up @@ -125,6 +147,16 @@ examples:
meta:
text: GOV.UK Prototype Kit v7.0.1

- name: with custom licence text
description: Custom licence section
data:
licence: GOVUK Licence
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @georgeeker, this will need to have a .text or .html property to work.

See the preview: https://govuk-frontend-review-pr-1314.herokuapp.com/components/footer/with-custom-licence-text/preview

It's not triggering {% if params.licence.html or params.licence.text %}


- name: with custom copyright text
description: Custom copyright section
data:
logoText: Copyright
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be added to Nunjucks template too?


- name: with meta links and meta content
description: Secondary navigation links and custom meta text
data:
Expand Down
8 changes: 8 additions & 0 deletions src/components/footer/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,27 @@
/>
</svg>
<span class="govuk-footer__licence-description">
{% if params.licence.html or params.licence.text %}
{{ params.licence.html | safe if params.licence.html else params.licence.text }}
{% else %}
All content is available under the
<a
class="govuk-footer__link"
href="https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/"
rel="license"
>Open Government Licence v3.0</a>, except where otherwise stated
{% endif %}
</span>
</div>
<div class="govuk-footer__meta-item">
{% if params.copyright.html or params.copyright.text %}
{{ params.copyright.html | safe if params.copyright.html else params.copyright.text }}
{% else %}
<a
class="govuk-footer__link govuk-footer__copyright-logo"
href="https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/"
>© Crown copyright</a>
{% endif %}
</div>
</div>
</div>
Expand Down
24 changes: 24 additions & 0 deletions src/components/footer/template.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,30 @@ describe('footer', () => {
expect($custom.text()).toContain('GOV.UK Prototype Kit v7.0.1')
})

it('renders custom licence text', () => {
const $ = render('footer', {
licence: {
text: 'GOV.UK Licence'
}
})

const $component = $('.govuk-footer')
const $custom = $component.find('.govuk-footer__licence-description')
expect($custom.text()).toContain('GOV.UK Licence')
})

it('renders custom licence text', () => {
const $ = render('footer', {
licence: {
html: 'GOV.UK Licence'
}
})

const $component = $('.govuk-footer')
const $custom = $component.find('.govuk-footer__licence-description')
expect($custom.text()).toContain('GOV.UK Licence')
})

it('renders attributes on meta links', () => {
const $ = render('footer', {
meta: {
Expand Down