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

Allow separate setting of fullWidth and wide to header and footer params in layout #3409

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
89 changes: 89 additions & 0 deletions src/foundations/page-template/example-custom-test-two.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
title: 'Example: Customised page template'
layout: ~
---

{% extends "layout/_template.njk" %}
{%
set pageConfig = {
"header": {
"title": "Social survey Two",
"phase": {
"badge": 'BETA',
"html": 'This is a new service – your <a href="#feedback">feedback</a> will help us improve it.'
},
"signoutButton": {
"text": "Save and sign out",
"iconType": "exit",
"iconPosition": "after"
},
"language": {
"languages": [
{
"url": "#0",
"isoCode": "en",
"text": "English",
"current": true
},
{
"url": "#0",
"isoCode": "cy",
"text": "Cymraeg",
"current": false
}
]
},
"wide": false,
"fullWidth": true
},
"breadcrumbs": {
"ariaLabel": 'Breadcrumbs',
"itemsList": [
{
"url": '/',
"text": 'Home'
},
{
"url": '/components',
"text": 'Components'
}
]
},
"footer": {
"rows": [
{
"itemsList": [
{
"text": 'Contact us',
"url": '#0'
},
{
"text": 'Cookies and privacy',
"url": '#0'
}
]
}
],
"oglLink": {
"pre": 'All content is available under the',
"link": 'Open Government Licence v3.0',
"url": 'https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/',
"post": ', except where otherwise stated'
},
"wide": false,
"fullWidth": true

},
"wide": false,
"fullWidth": false
}
%}
{% block main %}
<h1>Page Title</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
<p>
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
</p>
<p>Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
{% endblock %}
84 changes: 84 additions & 0 deletions src/foundations/page-template/example-custom-test.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
title: 'Example: Customised page template'
layout: ~
---

{% extends "layout/_template.njk" %}
{%
set pageConfig = {
"header": {
"title": "Social survey One",
"phase": {
"badge": 'BETA',
"html": 'This is a new service – your <a href="#feedback">feedback</a> will help us improve it.'
},
"signoutButton": {
"text": "Save and sign out",
"iconType": "exit",
"iconPosition": "after"
},
"language": {
"languages": [
{
"url": "#0",
"isoCode": "en",
"text": "English",
"current": true
},
{
"url": "#0",
"isoCode": "cy",
"text": "Cymraeg",
"current": false
}
]
}
},
"breadcrumbs": {
"ariaLabel": 'Breadcrumbs',
"itemsList": [
{
"url": '/',
"text": 'Home'
},
{
"url": '/components',
"text": 'Components'
}
]
},
"footer": {
"rows": [
{
"itemsList": [
{
"text": 'Contact us',
"url": '#0'
},
{
"text": 'Cookies and privacy',
"url": '#0'
}
]
}
],
"oglLink": {
"pre": 'All content is available under the',
"link": 'Open Government Licence v3.0',
"url": 'https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/',
"post": ', except where otherwise stated'
}
},
"wide": true,
"fullWidth": true
}
%}
{% block main %}
<h1>Page Title</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
<p>
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
</p>
<p>Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
{% endblock %}
8 changes: 4 additions & 4 deletions src/layout/_template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@
{% block header %}
{{
onsHeader({
"wide": pageConfig.wide,
"fullWidth": pageConfig.fullWidth,
"wide": pageConfig.header.wide | default(pageConfig.wide),
"fullWidth": pageConfig.header.fullWidth | default(pageConfig.fullWidth),
"language": pageConfig.header.language,
"button": pageConfig.header.signoutButton,
"toggleNavigationButton": pageConfig.header.toggleNavigationButton,
Expand Down Expand Up @@ -200,8 +200,8 @@
{% if pageConfig.footer %}
{{
onsFooter({
"wide": pageConfig.wide,
"fullWidth": pageConfig.fullWidth,
"wide": pageConfig.footer.wide | default(pageConfig.wide),
"fullWidth": pageConfig.footer.fullWidth | default(pageConfig.fullWidth),
"classes": "ons-page__footer",
"lang": currentLanguageIsoCode,
"rows": pageConfig.footer.rows,
Expand Down
Loading