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

Draft: Adding an 'account' section to header #983

Closed
wants to merge 8 commits into from
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{% set html_style = 'background-color: #f0f4f5;' %}
{% set title = 'Header transactional service that is signed in' %}
{% from 'components/header/macro.njk' import header %}
{% extends 'layout.njk' %}

{% block body %}

{{ header({
"service": {
"name": "This is a service with a very long name"
},
"showNav": "true",
"showSearch": "false",
"account": {
"items": [
{
label: {
text: "Organisation name (B483)"
}
},
{
label: {
text: "Account settings"
},
href: "#"
},
{
label: {
text: "Sign out"
},
href: "#"
}
]
},
"primaryLinks": [
{
"url" : "#",
"label" : "Find a patient"
},
{
'url' : '#',
'label' : 'Consultation schedule'
},
{
'url' : '#',
'label' : 'Settings'
}
]
})
}}

{% endblock %}
47 changes: 47 additions & 0 deletions app/components/header/header-service-signed-in.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{% set html_style = 'background-color: #f0f4f5;' %}
{% set title = 'Header transactional service that is signed in' %}
{% from 'components/header/macro.njk' import header %}
{% extends 'layout.njk' %}

{% block body %}

{{ header({
"service": {
"name": "Invite patients to a consultation"
},
"showNav": "true",
"showSearch": "false",
"account": {
"items": [
{
label: {
text: "My account"
},
href: "#"
},
{
label: {
text: "Sign out"
},
href: "#"
}
]
},
"primaryLinks": [
{
"url" : "#",
"label" : "Find a patient"
},
{
'url' : '#',
'label' : 'Consultation schedule'
},
{
'url' : '#',
'label' : 'Settings'
}
]
})
}}

{% endblock %}
3 changes: 3 additions & 0 deletions app/pages/examples.njk
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@
<li><a href="../components/header/header-logo.html">Header with logo only</a></li>
<li><a href="../components/header/header-service-name.html">Header with a service name</a></li>
<li><a href="../components/header/header-service-name-with-nav.html">Header with a service name, search and navigation</a></li>
<li><a href="../components/header/header-service-signed-in.html">Header with a service name, signed in</a></li>
<li><a href="../components/header/header-service-name-lots-of-account-items.html">Header with a service name and lots of account items</a></li>

<li><a href="../components/header/header-transactional-service-name.html">Header transactional with service name</a></li>
<li><a href="../components/header/header-org.html">Header organisational</a></li>
<li><a href="../components/header/header-org-white.html">Header organisational with white header</a></li>
Expand Down
21 changes: 6 additions & 15 deletions packages/components/header/_header-service.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
text-decoration: none;
width: auto;

@include mq($from: large-desktop) {
align-items: center;
display: flex;
-ms-flex-align: center;
margin-bottom: 0;
width: auto;
}
align-items: center;
display: flex;
-ms-flex-align: center;
margin-bottom: 0;
width: auto;

&:hover {
background: none;
Expand Down Expand Up @@ -43,17 +41,10 @@

.nhsuk-header__service-name {
@include nhsuk-font(19);

color: $color_nhsuk-white;
display: block;
padding-left: 0;
padding-right: 0;
padding-left: nhsuk-spacing(3);

@include mq($from: large-desktop) {
padding-left: nhsuk-spacing(3);
}

@include mq($until: large-desktop) {
max-width: 220px;
}
}
65 changes: 49 additions & 16 deletions packages/components/header/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,9 @@
@include govuk-width-container;
padding: 20px 0;

@include mq($until: tablet) {
padding-bottom: 0;
}

@include mq($from: tablet) {
border-bottom: 1px solid $color_transparent_nhsuk-white-20;
display: flex;
justify-content: space-between;
}
border-bottom: 1px solid $color_transparent_nhsuk-white-20;
display: flex;
justify-content: space-between;
}

.nhsuk-header__logo {
Expand Down Expand Up @@ -162,13 +156,9 @@
.nhsuk-header__search-form {
height: 100%;
overflow: visible;

@include mq($until: tablet) {
display: flex;
margin: nhsuk-spacing(3) 0 0;
position: relative;
width: 100%;
}
width: 100%;
position: relative;
display: flex;
}

.nhsuk-header__search-wrap {
Expand Down Expand Up @@ -541,3 +531,46 @@
justify-content: initial;
}
}

// Account section
.nhsuk-header__account {
margin-right: 0;

/* TODO: This is to move the section closer to the top
on mobile but is only rough. */
margin-top: -5px;

display: flex;
flex-direction: column;
align-items: flex-end;
text-align: right;
}

.nhsuk-header__account-item {
@include nhsuk-font(16);
display: inline-block;
color: $color_nhsuk-white;
font-size: inherit;
padding: nhsuk-spacing(1) 0;
white-space: nowrap;
margin-left: nhsuk-spacing(4);
}

a.nhsuk-header__account-item {
text-decoration: underline;
}

.nhsuk-header__account-item:hover {
box-shadow: none;
color: $color_nhsuk-white;
text-decoration: none;
}

.nhsuk-header__account-item:focus {
background-color: $nhsuk-focus-color;
color: $nhsuk-focus-text-color;
}

.nhsuk-header__account-item:visited {
color: $color_nhsuk-white;
}
16 changes: 16 additions & 0 deletions packages/components/header/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,22 @@

{% endif -%}

{% if params.account %}
<div class="nhsuk-header__account {%- if params.account.classes %} {{ params.account.classes }}{% endif %}">
{% if params.account.items %}
<div class="nhsuk-header__account-items">
{% for item in params.account.items %}
{% if item.href %}
<a href="{{ item.href }}" class="nhsuk-header__account-item {%- if item.classes %} {{ item.classes }}{% endif %}">{{ item.label.html | safe if item.label.html else item.label.text }}</a>
{% else %}
<span class="nhsuk-header__account-item {%- if item.classes %} {{ item.classes }}{% endif %}">{{ item.label.html | safe if item.label.html else item.label.text }}</span>
{% endif %}
{% endfor %}
</div>
{% endif %}
</div>
{% endif %}

{% if showNav == "true" and params.primaryLinks and showSearch == "true" %}

<div class="nhsuk-header__content" id="content-header">
Expand Down
Loading