Skip to content

Commit aab2601

Browse files
Reduce the amount of scrolling need within session pages
1 parent df645a5 commit aab2601

12 files changed

Lines changed: 94 additions & 29 deletions

File tree

app/assets/stylesheets/components/_filters.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
padding-left: nhsuk-spacing(3);
1515
background-color: nhsuk-colour("grey-1");
1616

17+
@include nhsuk-font-size(22);
18+
1719
// stylelint-disable-next-line max-nesting-depth
1820
@include nhsuk-media-query($from: tablet) {
1921
margin-left: #{nhsuk-spacing(-4) - 1px};

app/assets/stylesheets/components/_session-banner.scss

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "sass:color";
12
@use "../vendor/nhsuk-frontend" as *;
23

34
.app-session-banner {
@@ -30,4 +31,57 @@
3031
.nhsuk-notification-banner__heading {
3132
color: $nhsuk-reverse-text-colour;
3233
}
34+
35+
.app-secondary-navigation {
36+
margin: 0;
37+
border-bottom: 0 none;
38+
background: nhsuk-shade($nhsuk-brand-colour, 20%);
39+
box-shadow: 0 -1px 0 0 $nhsuk-secondary-border-colour;
40+
}
41+
42+
.app-secondary-navigation__list {
43+
box-shadow: none;
44+
45+
@include nhsuk-media-query($until: tablet) {
46+
margin-left: #{$nhsuk-gutter-half * -1};
47+
}
48+
}
49+
50+
&[data-app-sticky-init] {
51+
position: sticky;
52+
z-index: 999;
53+
top: 0;
54+
right: 0;
55+
left: 0;
56+
57+
width: 100vw;
58+
margin-right: -50vw;
59+
margin-left: -50vw;
60+
}
61+
62+
&[data-stuck="true"] {
63+
border-bottom-color: nhsuk-colour("grey-3");
64+
box-shadow: 0 $nhsuk-border-width 0 color.scale(nhsuk-colour("grey-3"), $alpha: -50%);
65+
66+
.app-main-wrapper--xs {
67+
padding-top: nhsuk-spacing(2);
68+
padding-bottom: 0;
69+
}
70+
71+
.nhsuk-breadcrumb {
72+
@include nhsuk-visually-hidden;
73+
}
74+
75+
.nhsuk-heading-l {
76+
@include nhsuk-font-size(22);
77+
}
78+
79+
.app-secondary-navigation {
80+
box-shadow: none;
81+
}
82+
83+
.app-secondary-navigation__list {
84+
@include nhsuk-font-size(16);
85+
}
86+
}
3387
}

app/assets/stylesheets/components/_sticky-navigation.scss

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,3 @@
3434
box-shadow: 0 $nhsuk-border-width 0 color.scale(nhsuk-colour("grey-3"), $alpha: -50%);
3535
}
3636
}
37-
38-
.app-sticky-navigation--reverse {
39-
border-bottom: 0 none;
40-
background: nhsuk-shade($nhsuk-brand-colour, 20%);
41-
42-
.app-secondary-navigation {
43-
box-shadow: 0 -1px 0 0 $nhsuk-reverse-border-colour;
44-
}
45-
}

app/assets/stylesheets/core/objects/_grid.scss

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[class^="app-grid-column"],
55
[class^="nhsuk-grid-column"] {
66
&[data-app-sticky-init] {
7-
@include nhsuk-media-query($from: desktop) {
7+
@include nhsuk-media-query($from: large-desktop) {
88
position: sticky;
99
top: 0;
1010
}
@@ -19,11 +19,9 @@
1919
.app-grid-column-patient-record {
2020
@include nhsuk-grid-column(one-quarter, $float: right, $at: large-desktop);
2121

22-
padding-top: 12px;
23-
2422
&[data-app-sticky-init] {
25-
@include nhsuk-media-query($from: desktop) {
26-
top: #{nhsuk-spacing(9) + nhsuk-spacing(3)};
23+
@include nhsuk-media-query($from: large-desktop) {
24+
top: #{nhsuk-spacing(9) + nhsuk-spacing(5)};
2725
}
2826
}
2927
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
@forward "grid";
2+
@forward "main-wrapper";
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@use "../../vendor/nhsuk-frontend" as *;
2+
3+
.app-main-wrapper--xs {
4+
padding-top: nhsuk-spacing(3);
5+
padding-bottom: nhsuk-spacing(3);
6+
}

app/models/session.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,21 @@ export class Session {
581581
}
582582
}
583583

584+
/**
585+
* Get short name (without dates)
586+
*
587+
* @returns {string|undefined} Short name
588+
*/
589+
get shortName() {
590+
if (this.clinic) {
591+
return `${this.programmeNames.titleCase} community clinic`
592+
}
593+
594+
if (this.location) {
595+
return `${this.programmeNames.titleCase} session at ${this.location.name}`
596+
}
597+
}
598+
584599
/**
585600
* Get address
586601
*

app/views/_layouts/session.njk

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{% extends "_layouts/default.njk" %}
22

33
{% block main %}
4-
<div class="app-session-banner">
4+
<div class="app-session-banner"{% if stickyBanner %} data-module="app-sticky"{% endif %}>
55
<div class="nhsuk-width-container">
66
{% block beforeContent %}{% endblock %}
77

8-
<div class="nhsuk-main-wrapper nhsuk-main-wrapper--s">
8+
<div class="nhsuk-main-wrapper app-main-wrapper--xs">
99
{{ notificationBanner(success) if success }}
1010
{{ notificationBanner(message) if message }}
1111

@@ -18,11 +18,7 @@
1818
</p>
1919
{% endif %}
2020
</div>
21-
</div>
22-
</div>
2321

24-
<div class="app-sticky-navigation app-sticky-navigation--reverse" data-module="app-sticky">
25-
<div class="nhsuk-width-container">
2622
{{ appSecondaryNavigation({
2723
classes: "app-secondary-navigation--reverse",
2824
items: navigationItems
@@ -31,7 +27,7 @@
3127
</div>
3228

3329
<div class="nhsuk-width-container">
34-
<main class="nhsuk-main-wrapper" id="maincontent" role="main">
30+
<main class="nhsuk-main-wrapper nhsuk-main-wrapper--s" id="maincontent" role="main">
3531
<form method="post" novalidate data-validate>
3632
{% block content %}
3733
{% endblock %}

app/views/patient-session/events.njk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{% extends "_layouts/session.njk" %}
22

3-
{% set title = patient.fullName + "" + __("patient.events.title") %}
3+
{% set title = patient.initials + "" + session.shortName + "" + __("patient.events.title") %}
44
{% set heading = patientSession.patient.fullName %}
5+
{% set stickyBanner = true %}
56
{% set view = "events" %}
67

78
{% block beforeContent %}

app/views/patient-session/show.njk

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{% extends "_layouts/session.njk" %}
22

3-
{% set title = patient.initials + "" + session.location.name %}
3+
{% set title = patient.initials + "" + session.shortName %}
44
{% set heading = patientSession.patient.fullName %}
5+
{% set stickyBanner = true %}
56

67
{% block beforeContent %}
78
{{ breadcrumb({
89
classes: "nhsuk-breadcrumb--reverse",
910
items: [{
10-
text: session.name,
11+
text: session.shortName,
1112
href: session.uri
1213
}, {
1314
text: __("session." + activity + ".label"),

0 commit comments

Comments
 (0)