-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
176 additions
and
416 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
$hub-spacing: 1rem; | ||
|
||
.hub { | ||
&__row { | ||
padding: $hub-spacing 0; | ||
|
||
&:not(:first-child) { | ||
border-top: 1px solid $color-grey-2; | ||
} | ||
} | ||
|
||
&__title { | ||
position: relative; | ||
margin: 0 0 ($hub-spacing / 2); | ||
|
||
&--complete { | ||
padding-left: $hub-spacing + 1rem; | ||
|
||
&:before { | ||
@include icon('check-green'); | ||
|
||
content: ''; | ||
position: absolute; | ||
top: 50%; | ||
left: 0; | ||
transform: translateY(-50%); | ||
} | ||
} | ||
} | ||
|
||
&__status { | ||
@extend .u-fs-r--b; | ||
|
||
margin: 0; | ||
} | ||
|
||
@include mq('s') { | ||
&__row { | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
|
||
&__title { | ||
margin: 0 ($hub-spacing / 2) 0 0; | ||
} | ||
|
||
&__status { | ||
margin: 0 0 0 ($hub-spacing / 2); | ||
text-align: right; | ||
white-space: nowrap; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
| Name | Type | Required | Description | | ||
| -------- | ----------------- | -------- | -------------------- | | ||
| sections | Array<HubSection> | true | An array of sections | | ||
|
||
## HubSection | ||
|
||
| Name | Type | Required | Description | | ||
| --------- | ------- | -------- | ------------------------------------------------------------------------- | | ||
| completed | boolean | true | Whether or not the section has been completed | | ||
| title | string | true | The name of the section (e.g. Your accommodation) | | ||
| ariaLabel | string | true | Aria label for the title link (e.g. Continue section: Your accommodation) | | ||
| url | string | true | URL for the title link | | ||
| status | string | true | Status text for the section (e.g. Partially complete) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{% macro onsHub(params) %} | ||
<dl class="hub{% if params.classes %} {{ params.classes }}{% endif %}"> | ||
{% for section in (params.sections if params.sections is iterable else params.sections.items()) %} | ||
<div class="hub__row"> | ||
<dt class="hub__title{% if section.completed %} hub__title--complete{% endif %}"> | ||
<a href="{{ section.url }}" aria-label="{{ section.ariaLabel }}">{{ section.title }}</a> | ||
</dt> | ||
<dd class="hub__status"> | ||
{{ section.status }} | ||
</dd> | ||
</div> | ||
{% endfor %} | ||
</dl> | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
--- | ||
layout: none | ||
--- | ||
{% extends "styles/page-template/_template.njk" %} | ||
|
||
{% from "components/panel/_macro.njk" import onsPanel %} | ||
{% from "components/hub/_macro.njk" import onsHub %} | ||
{% from "components/button/_macro.njk" import onsButton %} | ||
|
||
{% set page = { | ||
"title": "Hub Example", | ||
"signoutButton": { | ||
"text": "Save and complete later" | ||
} | ||
} %} | ||
|
||
{% block main %} | ||
<h1 class="u-mt-m">Choose another section to complete</h1> | ||
|
||
{% call onsPanel() %} | ||
<p><strong>You must complete all sections in order to submit this survey</strong></p> | ||
{% endcall %} | ||
|
||
{{ onsHub({ | ||
"classes": "u-mt-m", | ||
"sections": [ | ||
{ | ||
"title": "People who live here", | ||
"ariaLabel": "View and change answers for: People who live here", | ||
"url": "#", | ||
"completed": true, | ||
"status": "Completed" | ||
}, | ||
{ | ||
"title": "Accommodation", | ||
"ariaLabel": "View and change answers for: Accommodation", | ||
"url": "#", | ||
"completed": true, | ||
"status": "Completed" | ||
}, | ||
{ | ||
"title": "Mary Smith (you)", | ||
"ariaLabel": "View and change answers for: Mary Smith", | ||
"url": "#", | ||
"completed": true, | ||
"status": "Completed" | ||
}, | ||
{ | ||
"title": "John Smith", | ||
"ariaLabel": "Continue section: John Smith", | ||
"url": "#", | ||
"completed": false, | ||
"status": "Partially complete" | ||
}, | ||
{ | ||
"title": "Billy Smith", | ||
"ariaLabel": "Start section: Billy Smith", | ||
"url": "#", | ||
"completed": false, | ||
"status": "Not started" | ||
}, | ||
{ | ||
"title": "Sally Smith", | ||
"ariaLabel": "Start section: Sally Smith", | ||
"url": "#", | ||
"completed": false, | ||
"status": "Not started" | ||
}, | ||
{ | ||
"title": "Wilhelmina Susannah Clementine-Smith (Visitor)", | ||
"ariaLabel": "Start section: Wilhelmina Susannah Clementine-Smith", | ||
"url": "#", | ||
"completed": false, | ||
"status": "Not started" | ||
} | ||
] | ||
}) }} | ||
|
||
{{ | ||
onsButton({ | ||
"text": 'Continue', | ||
"classes": 'u-mb-m u-mt-l' | ||
}) | ||
}} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.