govuk_publishing_components 27.17.0 → 27.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d9ee129bde5e753f8180b3b8dfe7f2e4fe257558ac1a6fe40bb289242d849f2
4
- data.tar.gz: 4c01bb1d55673a25eef1a408e5360da17b2d4e1a8dfc00291463ecc86dfcd81a
3
+ metadata.gz: 49373bd0b9e370b948f7c91c83647ca22f7f2e112bb0d12dee4686c980f831f4
4
+ data.tar.gz: 4868f4234fcf242d553c90ab60f35e2354480c30f6c44f3066b5fc60079175b7
5
5
  SHA512:
6
- metadata.gz: 5eac4c820f6c86caded7a9e994f1e9e15edbb6ab7fce003ae38f9919dcc6a23f3db7f9dfcd27e0204152e17daa35ccb741ce457b6c9c3c85a8ae51350362fe3c
7
- data.tar.gz: b9e8068c2b0746134a37e21fefdd8cc6114055e133fa7240e801be587f34f8ff8a7dd218a71f34cda1fe8dce5c54da3109544d0775e103c2a90e9bec153cd018
6
+ metadata.gz: 7e68c23966e5498ca1ae0c386d2a91703b94bac02808fbae86755ca35b12d3fdd45859a2d3eaa6f052912890296554c0478c717354bd29fb1dd5336a8a3bad5e
7
+ data.tar.gz: ada5d7c714155391431943c17850d379e4bc9fce3e20fa35bff736b21b60b13d92140dbd7102237f2c64b9c0a948723954e677ef5935b4d91b7bc6a4014bfbd9
@@ -75,7 +75,7 @@
75
75
 
76
76
  if (!attributeValue) { return }
77
77
 
78
- if (attributeValue.includes('?')) {
78
+ if (attributeValue.indexOf('?') !== -1) {
79
79
  attributeValue += '&' + param
80
80
  } else {
81
81
  attributeValue += '?' + param
@@ -1,4 +1,4 @@
1
- /* global GOVUK, $ */
1
+ /* global GOVUK */
2
2
 
3
3
  (function () {
4
4
  'use strict'
@@ -8,17 +8,17 @@
8
8
  PageContent.getNumberOfSections = function () {
9
9
  switch (true) {
10
10
  case isNavigationGridPage():
11
- return 1 + $('.parent-topic-contents').length
11
+ return 1 + document.querySelectorAll('.parent-topic-contents').length
12
12
  case isNavigationAccordionPage():
13
- return $('[data-track-count="accordionSection"]').length
13
+ return document.querySelectorAll('[data-track-count="accordionSection"]').length
14
14
  case isDocumentCollectionPage():
15
- return $('.document-collection .group-title').length
15
+ return document.querySelectorAll('.document-collection .group-title').length
16
16
  case isMainstreamBrowsePage():
17
- return $('#subsection ul:visible').length || $('#section ul').length
17
+ return countVisible(document.querySelectorAll('#subsection ul')) || document.querySelectorAll('#section ul').length
18
18
  case isTopicPage():
19
- return $('.topics-page nav.index-list').length
19
+ return document.querySelectorAll('.topics-page nav.index-list').length
20
20
  case isPolicyAreaPage():
21
- return $('.topic section h1.label').length
21
+ return document.querySelectorAll('.topic section h1.label').length
22
22
  case isFinderPage():
23
23
  case isWhitehallFinderPage():
24
24
  case isNavigationLeafPage():
@@ -28,8 +28,8 @@
28
28
  return 1
29
29
  default:
30
30
  // It's a content page, not a "finding" page
31
- var sidebarSections = $('[data-track-count="sidebarRelatedItemSection"]').length
32
- var sidebarTaxons = $('[data-track-count="sidebarTaxonSection"]').length
31
+ var sidebarSections = document.querySelectorAll('[data-track-count="sidebarRelatedItemSection"]').length
32
+ var sidebarTaxons = document.querySelectorAll('[data-track-count="sidebarTaxonSection"]').length
33
33
 
34
34
  return sidebarSections || sidebarTaxons
35
35
  }
@@ -38,92 +38,101 @@
38
38
  PageContent.getNumberOfLinks = function () {
39
39
  switch (true) {
40
40
  case isNavigationGridPage():
41
- return $('a[data-track-category="navGridLinkClicked"]').length +
42
- $('a[data-track-category="navGridLeafLinkClicked"]').length
41
+ return document.querySelectorAll('a[data-track-category="navGridLinkClicked"]').length +
42
+ document.querySelectorAll('a[data-track-category="navGridLeafLinkClicked"]').length
43
43
  case isNavigationAccordionPage():
44
- return $('a[data-track-category="navAccordionLinkClicked"]').length
45
- case isNavigationLeafPage():
46
- return $('a[data-track-category="navLeafLinkClicked"]').length
44
+ return document.querySelectorAll('a[data-track-category="navAccordionLinkClicked"]').length
47
45
  case isDocumentCollectionPage():
48
- return $('.document-collection .group-document-list li a').length
46
+ return document.querySelectorAll('.document-collection .group-document-list li a').length
49
47
  case isMainstreamBrowsePage():
50
- return $('#subsection ul a:visible').length ||
51
- $('#section ul a').length
48
+ return countVisible(document.querySelectorAll('#subsection ul a')) || document.querySelectorAll('#section ul a').length
52
49
  case isTopicPage():
53
- return $('.topics-page .index-list ul a').length ||
54
- $('.topics-page .topics ul a').length
50
+ return document.querySelectorAll('.topics-page .index-list ul a').length ||
51
+ document.querySelectorAll('.topics-page .topics ul a').length
55
52
  case isPolicyAreaPage():
56
- return $('section.document-block a').length +
57
- $('section .collection-list h2 a').length
58
- case isWhitehallFinderPage():
59
- return $('.document-list .document-row h3 a').length
53
+ return document.querySelectorAll('section.document-block a').length +
54
+ document.querySelectorAll('section .collection-list h2 a').length
60
55
  case isFinderPage():
61
- return $('.finder-frontend-content li.document a').length
56
+ return document.querySelectorAll('.finder-frontend-content li.document a').length
57
+ case isWhitehallFinderPage():
58
+ return document.querySelectorAll('.document-list .document-row h3 a').length
59
+ case isNavigationLeafPage():
60
+ return document.querySelectorAll('a[data-track-category="navLeafLinkClicked"]').length
62
61
  default:
63
62
  // It's a content page, not a "finding" page, count related links
64
- return $('a[data-track-category="relatedLinkClicked"]').length
63
+ return document.querySelectorAll('a[data-track-category="relatedLinkClicked"]').length
65
64
  }
66
65
  }
67
66
 
68
- function getRenderingApplication () {
69
- return $('meta[name="govuk:rendering-application"]').attr('content')
70
- };
71
-
72
- function getFormat () {
73
- return $('meta[name="govuk:format"]').attr('content')
74
- };
67
+ var metaApplicationSelector = 'meta[name="govuk:rendering-application"]'
68
+ var metaFormatSelector = 'meta[name="govuk:format"]'
69
+ var metaNavigationTypeSelector = 'meta[name="govuk:navigation-page-type"]'
75
70
 
76
- function getNavigationPageType () {
77
- return $('meta[name="govuk:navigation-page-type"]').attr('content')
78
- };
71
+ function getMetaAttribute (selector) {
72
+ var element = document.querySelector(selector)
73
+ if (element) {
74
+ return element.getAttribute('content')
75
+ }
76
+ }
79
77
 
80
78
  function isNavigationGridPage () {
81
- return getRenderingApplication() === 'collections' &&
82
- getFormat() === 'taxon' &&
83
- getNavigationPageType() === 'grid'
84
- };
79
+ return getMetaAttribute(metaApplicationSelector) === 'collections' &&
80
+ getMetaAttribute(metaFormatSelector) === 'taxon' &&
81
+ getMetaAttribute(metaNavigationTypeSelector) === 'grid'
82
+ }
85
83
 
86
84
  function isNavigationAccordionPage () {
87
- return getRenderingApplication() === 'collections' &&
88
- getFormat() === 'taxon' &&
89
- getNavigationPageType() === 'accordion'
90
- };
85
+ return getMetaAttribute(metaApplicationSelector) === 'collections' &&
86
+ getMetaAttribute(metaFormatSelector) === 'taxon' &&
87
+ getMetaAttribute(metaNavigationTypeSelector) === 'accordion'
88
+ }
91
89
 
92
90
  function isNavigationLeafPage () {
93
- return getRenderingApplication() === 'collections' &&
94
- getFormat() === 'taxon' &&
95
- getNavigationPageType() === 'leaf'
96
- };
91
+ return getMetaAttribute(metaApplicationSelector) === 'collections' &&
92
+ getMetaAttribute(metaFormatSelector) === 'taxon' &&
93
+ getMetaAttribute(metaNavigationTypeSelector) === 'leaf'
94
+ }
97
95
 
98
96
  function isMainstreamBrowsePage () {
99
- return getRenderingApplication() === 'collections' &&
100
- getFormat() === 'mainstream_browse_page'
101
- };
97
+ return getMetaAttribute(metaApplicationSelector) === 'collections' &&
98
+ getMetaAttribute(metaFormatSelector) === 'mainstream_browse_page'
99
+ }
102
100
 
103
101
  function isTopicPage () {
104
- return getRenderingApplication() === 'collections' &&
105
- getFormat() === 'topic'
106
- };
102
+ return getMetaAttribute(metaApplicationSelector) === 'collections' &&
103
+ getMetaAttribute(metaFormatSelector) === 'topic'
104
+ }
107
105
 
108
106
  function isPolicyAreaPage () {
109
- return getRenderingApplication() === 'whitehall' &&
110
- getFormat() === 'placeholder_policy_area'
111
- };
107
+ return getMetaAttribute(metaApplicationSelector) === 'whitehall' &&
108
+ getMetaAttribute(metaFormatSelector) === 'placeholder_policy_area'
109
+ }
112
110
 
113
111
  function isDocumentCollectionPage () {
114
- return getRenderingApplication() === 'government-frontend' &&
115
- getFormat() === 'document_collection'
116
- };
112
+ return getMetaAttribute(metaApplicationSelector) === 'government-frontend' &&
113
+ getMetaAttribute(metaFormatSelector) === 'document_collection'
114
+ }
117
115
 
118
116
  function isFinderPage () {
119
- return getRenderingApplication() === 'finder-frontend' &&
120
- getFormat() === 'finder'
121
- };
117
+ return getMetaAttribute(metaApplicationSelector) === 'finder-frontend' &&
118
+ getMetaAttribute(metaFormatSelector) === 'finder'
119
+ }
122
120
 
123
121
  function isWhitehallFinderPage () {
124
- return getRenderingApplication() === 'whitehall' &&
125
- getFormat() === 'finder'
126
- };
122
+ return getMetaAttribute(metaApplicationSelector) === 'whitehall' &&
123
+ getMetaAttribute(metaFormatSelector) === 'finder'
124
+ }
125
+
126
+ function countVisible (elements) {
127
+ var count = 0
128
+ for (var i = 0; i < elements.length; i++) {
129
+ var style = window.getComputedStyle(elements[i])
130
+ if (!(style.display === 'none' || style.visibility === 'hidden')) {
131
+ count++
132
+ }
133
+ }
134
+ return count
135
+ }
127
136
 
128
137
  GOVUK.PageContent = PageContent
129
138
  })()
@@ -7,6 +7,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
7
7
  this.$module = $module
8
8
  this.basePath = this.$module.querySelector('input[name="base_path"]').value
9
9
  this.buttonLocation = this.$module.getAttribute('data-button-location')
10
+ this.buttonVisibleClass = 'gem-c-single-page-notification-button--visible'
10
11
 
11
12
  this.personalisationEndpoint = '/api/personalisation/check-email-subscription?base_path=' + this.basePath
12
13
  // This attribute is passed through to the personalisation API to ensure the updated button has the same button_location for analytics
@@ -16,21 +17,30 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
16
17
  SinglePageNotificationButton.prototype.init = function () {
17
18
  var xhr = new XMLHttpRequest()
18
19
  xhr.open('GET', this.personalisationEndpoint, true)
20
+ // if XHR to the personalisation endpoint is taking an incredibly long time to complete, we are better off leaving the button in its default unpersonalised state. Content changing before the user's eyes while they are browsing can be jarring and should be avoided.
21
+ xhr.timeout = 10000
22
+
23
+ xhr.ontimeout = function () {
24
+ this.makeVisible(this.$module)
25
+ }.bind(this)
19
26
 
20
27
  xhr.onreadystatechange = function () {
21
- if (xhr.readyState === 4 && xhr.status === 200) {
22
- var responseText = xhr.responseText
23
- // if response text exists and is JSON parse-able, parse the response and get the button html
24
- if (responseText && this.responseIsJSON(responseText)) {
25
- var newButton = JSON.parse(responseText).button_html
26
- var html = document.createElement('div')
27
- html.innerHTML = newButton
28
- // test that the html returned contains the button component; if yes, swap the button for the updated version
29
- var responseButtonContainer = html.querySelector('form.gem-c-single-page-notification-button')
30
- if (responseButtonContainer) {
31
- this.$module.parentNode.replaceChild(responseButtonContainer, this.$module)
28
+ if (xhr.readyState === 4) {
29
+ if (xhr.status === 200) {
30
+ var responseText = xhr.responseText
31
+ // if response text exists and is JSON parse-able, parse the response and get the button html
32
+ if (responseText && this.responseIsJSON(responseText)) {
33
+ var newButton = JSON.parse(responseText).button_html
34
+ var html = document.createElement('div')
35
+ html.innerHTML = newButton
36
+ // test that the html returned contains the button component; if yes, swap the button for the updated version
37
+ var responseButtonContainer = html.querySelector('form.gem-c-single-page-notification-button')
38
+ if (responseButtonContainer) {
39
+ this.$module.parentNode.replaceChild(responseButtonContainer, this.$module)
40
+ }
32
41
  }
33
42
  }
43
+ this.makeVisible(this.$module)
34
44
  }
35
45
  }.bind(this)
36
46
  xhr.send()
@@ -44,5 +54,9 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
44
54
  }
45
55
  return true
46
56
  }
57
+
58
+ SinglePageNotificationButton.prototype.makeVisible = function (target) {
59
+ target.classList.add(this.buttonVisibleClass)
60
+ }
47
61
  Modules.SinglePageNotificationButton = SinglePageNotificationButton
48
62
  })(window.GOVUK.Modules)
@@ -1,102 +1,5 @@
1
1
  @import "mixins/prefixed-transform";
2
-
3
- /// Set grid row or column value using the fraction unit.
4
- ///
5
- /// @param {Integer} $number - number of fractions that the grid row or column
6
- /// needs to be divided into.
7
- /// @returns {String} - the value
8
- ///
9
- /// @example scss - Five fractions will return `1fr 1fr 1fr 1fr 1fr`.
10
- /// .container {
11
- /// grid-template-rows: fractions(5);
12
- /// }
13
- ///
14
- @function fractions($number) {
15
- $fractions: "1fr";
16
-
17
- @for $i from 1 to $number {
18
- $fractions: $fractions + " 1fr";
19
- }
20
-
21
- @return unquote($fractions);
22
- }
23
-
24
- /// Arrange items into vertical columns
25
- ///
26
- /// @param {Integer} $items - number of items that need to be arranged
27
- /// @param {Integer} $columns - number of columns required
28
- /// @param {String} $selector - (optional) the inner element to be targeted.
29
- ///
30
- /// @example scss - A 7 item 2 column layout.
31
- /// .container {
32
- /// @include columns(7, 2);
33
- /// }
34
-
35
- /// @example scss - A 9 item 3 column layout that has `div`s as the inner
36
- /// elements.
37
- /// .container {
38
- /// @include columns(9, 3, "div");
39
- /// }
40
- ///
41
- @mixin columns($items, $columns, $selector: "*") {
42
- $rows: ceil($items / $columns);
43
-
44
- display: -ms-grid;
45
- display: grid;
46
- grid-auto-flow: column;
47
- -ms-grid-columns: fractions($columns);
48
- grid-template-columns: fractions($columns);
49
- -ms-grid-rows: fractions($rows);
50
- grid-template-rows: fractions($rows);
51
- }
52
-
53
- @mixin columns-children($items, $columns, $selector: "*") {
54
- $rows: ceil($items / $columns);
55
-
56
- // Internet Explorer 10-11 require each element to be placed in the grid -
57
- // the `grid-auto-flow` property isn't supported. This means that both the
58
- // column and row needs to be set for every element.
59
-
60
- // This creates a list of lists to represent the columns and rows; for
61
- // example, a 7 item 2 column list would create this:
62
- // [
63
- // [1, 2, 3, 4 ] // column one
64
- // [5, 6, 7] // column two
65
- // ]
66
- $grid: ();
67
- $counter: 0;
68
-
69
- @for $column from 1 through $columns {
70
- $this-row: ();
71
-
72
- @for $row from 1 through $rows {
73
- $counter: $counter + 1;
74
-
75
- @if $counter <= $items {
76
- $this-row: append($this-row, $counter);
77
- }
78
- }
79
-
80
- $grid: append($grid, $this-row, "comma");
81
- }
82
-
83
- // Now we can loop through the list of lists to create the rules needed for
84
- // the older grid syntax; fist looping through the list to get the number
85
- // needed for the column, then looping again to get the number for the grid
86
- // row:
87
- @for $column_index from 1 through length($grid) {
88
- $this-row: nth($grid, $column_index);
89
-
90
- @for $item-index from 1 through length($this-row) {
91
- $this-item: nth($this-row, $item-index);
92
-
93
- & > #{$selector}:nth-child(#{$this-item}) {
94
- -ms-grid-column: $column_index;
95
- -ms-grid-row: $item-index;
96
- }
97
- }
98
- }
99
- }
2
+ @import "mixins/grid-helper";
100
3
 
101
4
  $icon-size: 20px;
102
5
  $chevron-indent-spacing: 7px;
@@ -866,15 +769,13 @@ $pseudo-underline-height: 3px;
866
769
 
867
770
  .gem-c-layout-super-navigation-header__navigation-second-items--topics {
868
771
  @include govuk-media-query($from: "desktop") {
869
- @include columns(17, 2, "li");
870
- @include columns-children(17, 2, "li");
772
+ @include columns($items: 17, $columns: 2, $selector: "li", $flow: column);
871
773
  }
872
774
  }
873
775
 
874
776
  .gem-c-layout-super-navigation-header__navigation-second-items--government-activity {
875
777
  @include govuk-media-query($from: "desktop") {
876
- @include columns(6, 2, "li");
877
- @include columns-children(6, 2, "li");
778
+ @include columns($items: 6, $columns: 2, $selector: "li", $flow: column);
878
779
  padding-bottom: 0;
879
780
 
880
781
  & > li {
@@ -924,8 +825,7 @@ $pseudo-underline-height: 3px;
924
825
  padding: 0 0 govuk-spacing(8) govuk-spacing(4);
925
826
 
926
827
  @include govuk-media-query($from: "desktop") {
927
- @include columns(2, 2, "li");
928
- @include columns-children(2, 2, "li");
828
+ @include columns($items: 2, $columns: 2, $selector: "li");
929
829
  margin: 0 (0 - govuk-spacing(3));
930
830
  padding: govuk-spacing(6) 0 govuk-spacing(7) 0;
931
831
  }
@@ -963,6 +863,7 @@ $pseudo-underline-height: 3px;
963
863
  }
964
864
 
965
865
  .gem-c-layout-super-navigation-header__navigation-second-item-description {
866
+ @include govuk-typography-common;
966
867
  font-size: 16px;
967
868
  @if $govuk-typography-use-rem {
968
869
  font-size: govuk-px-to-rem(16px);
@@ -1,6 +1,25 @@
1
1
  $input-size: 40px;
2
2
  $large-input-size: 50px;
3
3
 
4
+ @mixin large-mode {
5
+ .gem-c-search__label {
6
+ @include govuk-font($size: 19, $line-height: $large-input-size);
7
+ }
8
+
9
+ .gem-c-search__input[type="search"] {
10
+ height: $large-input-size;
11
+ }
12
+
13
+ .gem-c-search__submit {
14
+ width: $large-input-size;
15
+ height: $large-input-size;
16
+
17
+ .gem-c-search__icon {
18
+ @include icon-positioning($large-input-size);
19
+ }
20
+ }
21
+ }
22
+
4
23
  .gem-c-search {
5
24
  position: relative;
6
25
  margin-bottom: 30px;
@@ -220,21 +239,12 @@ $large-input-size: 50px;
220
239
  }
221
240
 
222
241
  .gem-c-search--large {
223
- .gem-c-search__label {
224
- @include govuk-font($size: 19, $line-height: $large-input-size);
225
- }
226
-
227
- .gem-c-search__input[type="search"] {
228
- height: $large-input-size;
229
- }
230
-
231
- .gem-c-search__submit {
232
- width: $large-input-size;
233
- height: $large-input-size;
242
+ @include large-mode;
243
+ }
234
244
 
235
- .gem-c-search__icon {
236
- @include icon-positioning($large-input-size);
237
- }
245
+ .gem-c-search--large-on-mobile {
246
+ @include govuk-media-query($until: "tablet") {
247
+ @include large-mode;
238
248
  }
239
249
  }
240
250
 
@@ -28,3 +28,11 @@
28
28
  vertical-align: top;
29
29
  margin-right: govuk-spacing(1);
30
30
  }
31
+
32
+ .js-enabled .gem-c-single-page-notification-button.js-personalisation-enhancement {
33
+ opacity: 0;
34
+
35
+ &.gem-c-single-page-notification-button--visible {
36
+ opacity: 1;
37
+ }
38
+ }
@@ -0,0 +1,141 @@
1
+ /// Set grid row or column value using the fraction unit.
2
+ ///
3
+ /// @param {Integer} $number - number of fractions that the grid row or column
4
+ /// needs to be divided into.
5
+ /// @returns {String} - the value
6
+ ///
7
+ /// @example scss - Five fractions will return `1fr 1fr 1fr 1fr 1fr`.
8
+ /// .container {
9
+ /// grid-template-rows: fractions(5);
10
+ /// }
11
+ ///
12
+ @function fractions($number) {
13
+ $fractions: "1fr";
14
+
15
+ @for $i from 1 to $number {
16
+ $fractions: $fractions + " 1fr";
17
+ }
18
+
19
+ @return unquote($fractions);
20
+ }
21
+
22
+ /// Arrange items into columns
23
+ ///
24
+ /// The items can flow from horizontally or vertically.
25
+ ///
26
+ /// @param {Integer} $items - number of items that need to be arranged
27
+ /// @param {Integer} $columns - number of columns required
28
+ /// @param {String} $selector - (optional) the inner element to be targeted.
29
+ /// @param {String} $direction - (optional) the flow of the items in the grid:
30
+ /// * `row` goes from the left to right, top to bottom one row at a time
31
+ /// * `column` goes from the top to bottom, left to right one column at a time
32
+ ///
33
+ /// @example scss - A 7 item 2 column layout going left to right, top to bottom.
34
+ /// .container {
35
+ /// @include columns($items: 7, $columns: 2);
36
+ /// }
37
+ ///
38
+ /// @example scss - A 9 item 3 column layout that has `div`s as the inner
39
+ /// elements.
40
+ /// .container {
41
+ /// @include columns($items: 9, $columns: 3, $selector:"div");
42
+ /// }
43
+ ///
44
+ /// @example scss - A 16 item 2 column layout going from top to bottom
45
+ /// elements.
46
+ /// .container {
47
+ /// @include columns($items: 9, $columns: 3, $flow:"column");
48
+ /// }
49
+ ///
50
+ @mixin columns($items, $columns, $selector: "*", $flow: row) {
51
+ $rows: ceil($items / $columns);
52
+
53
+ display: -ms-grid;
54
+ display: grid;
55
+ grid-auto-flow: $flow;
56
+ -ms-grid-columns: fractions($columns);
57
+ grid-template-columns: fractions($columns);
58
+ -ms-grid-rows: fractions($rows);
59
+ grid-template-rows: fractions($rows);
60
+
61
+ // Internet Explorer 10-11 require each element to be placed in the grid -
62
+ // the `grid-auto-flow` property isn't supported. This means that both the
63
+ // column and row needs to be set for every child element.
64
+ @if $flow == "row" {
65
+ $grid: ();
66
+ $counter: 0;
67
+
68
+ @for $row from 1 through $rows {
69
+ $this-row: ();
70
+
71
+ @for $column from 1 through $columns {
72
+ $counter: $counter + 1;
73
+
74
+ // stylelint-disable max-nesting-depth
75
+ @if $counter <= $items {
76
+ $this-row: append($this-row, $counter);
77
+ }
78
+ // stylelint-enable max-nesting-depth
79
+ }
80
+
81
+ $grid: append($grid, $this-row, "comma");
82
+ }
83
+
84
+ @for $row-count from 1 through length($grid) {
85
+ $this-column: nth($grid, $row-count);
86
+
87
+ @for $item-index from 1 through length($this-column) {
88
+ $this-item: nth($this-column, $item-index);
89
+
90
+ & > #{$selector}:nth-child(#{$this-item}) {
91
+ -ms-grid-column: $item-index;
92
+ -ms-grid-row: $row-count;
93
+ }
94
+ }
95
+ }
96
+ }
97
+
98
+ @if $flow == "column" {
99
+ // This creates a list of lists to represent the columns and rows; for
100
+ // example, a 7 item 2 column list would create this:
101
+ // [
102
+ // [1, 2, 3, 4 ] // column one
103
+ // [5, 6, 7] // column two
104
+ // ]
105
+ $grid: ();
106
+ $counter: 0;
107
+
108
+ @for $column from 1 through $columns {
109
+ $this-row: ();
110
+
111
+ @for $row from 1 through $rows {
112
+ $counter: $counter + 1;
113
+
114
+ // stylelint-disable max-nesting-depth
115
+ @if $counter <= $items {
116
+ $this-row: append($this-row, $counter);
117
+ }
118
+ // stylelint-enable max-nesting-depth
119
+ }
120
+
121
+ $grid: append($grid, $this-row, "comma");
122
+ }
123
+
124
+ // Now we can loop through the list of lists to create the rules needed for
125
+ // the older grid syntax; fist looping through the list to get the number
126
+ // needed for the column, then looping again to get the number for the grid
127
+ // row:
128
+ @for $column_index from 1 through length($grid) {
129
+ $this-row: nth($grid, $column_index);
130
+
131
+ @for $item-index from 1 through length($this-row) {
132
+ $this-item: nth($this-row, $item-index);
133
+
134
+ & > #{$selector}:nth-child(#{$this-item}) {
135
+ -ms-grid-column: $column_index;
136
+ -ms-grid-row: $item-index;
137
+ }
138
+ }
139
+ }
140
+ }
141
+ }
@@ -21,6 +21,7 @@
21
21
  classes << (shared_helper.get_margin_top)
22
22
  classes << (shared_helper.get_margin_bottom) if local_assigns[:margin_bottom]
23
23
  classes << "gem-c-search--large" if size == "large"
24
+ classes << "gem-c-search--large-on-mobile" if size == "large-mobile"
24
25
  classes << "gem-c-search--no-border" if no_border
25
26
  if local_assigns[:on_govuk_blue].eql?(true)
26
27
  classes << "gem-c-search--on-govuk-blue"
@@ -9,7 +9,7 @@
9
9
  <svg class="gem-c-single-page-notification-button__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" height="18" width="18" viewBox="0 0 459.334 459.334"><path fill="currentColor" d="M177.216 404.514c-.001.12-.009.239-.009.359 0 30.078 24.383 54.461 54.461 54.461s54.461-24.383 54.461-54.461c0-.12-.008-.239-.009-.359H175.216zM403.549 336.438l-49.015-72.002v-89.83c0-60.581-43.144-111.079-100.381-122.459V24.485C254.152 10.963 243.19 0 229.667 0s-24.485 10.963-24.485 24.485v27.663c-57.237 11.381-100.381 61.879-100.381 122.459v89.83l-49.015 72.002a24.76 24.76 0 0 0 20.468 38.693H383.08a24.761 24.761 0 0 0 20.469-38.694z"/></svg><%= component_helper.button_text %>
10
10
  <% end %>
11
11
  <%= tag.div class: wrapper_classes, data: { module: "gem-track-click"} do %>
12
- <%= tag.form class: "gem-c-single-page-notification-button", action: "/email/subscriptions/single-page/new", method: "POST", data: component_helper.data do %>
12
+ <%= tag.form class: component_helper.classes, action: "/email/subscriptions/single-page/new", method: "POST", data: component_helper.data do %>
13
13
  <input type="hidden" name="base_path" value="<%= component_helper.base_path %>">
14
14
  <%= content_tag(:button, button_text, {
15
15
  class: "govuk-body-s gem-c-single-page-notification-button__submit",
@@ -44,6 +44,9 @@ examples:
44
44
  large_version:
45
45
  data:
46
46
  size: "large"
47
+ large_version_on_mobile_only:
48
+ data:
49
+ size: "large-mobile"
47
50
  change_field_name:
48
51
  description: To be used if you need to change the default name 'q'
49
52
  data:
@@ -1,6 +1,6 @@
1
1
  <div class="govuk-header__logo gem-c-header__logo">
2
2
  <a href="<%= logo_link %>" class="govuk-header__link govuk-header__link--homepage" data-module="gem-track-click" data-track-category="homeLinkClicked" data-track-action="homeHeader">
3
- <span class="govuk-header__logotype gem-c-header__logotype">
3
+ <span class="govuk-header__logotype gem-c-header__logotype header-logo">
4
4
  <!--[if gt IE 8]><!-->
5
5
  <svg aria-hidden="true" focusable="false" class="govuk-header__logotype-crown" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 132 97" height="30" width="36">
6
6
  <path fill="currentColor" fill-rule="evenodd" d="M25 30.2c3.5 1.5 7.7-.2 9.1-3.7 1.5-3.6-.2-7.8-3.9-9.2-3.6-1.4-7.6.3-9.1 3.9-1.4 3.5.3 7.5 3.9 9zM9 39.5c3.6 1.5 7.8-.2 9.2-3.7 1.5-3.6-.2-7.8-3.9-9.1-3.6-1.5-7.6.2-9.1 3.8-1.4 3.5.3 7.5 3.8 9zM4.4 57.2c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.5-1.5-7.6.3-9.1 3.8-1.4 3.5.3 7.6 3.9 9.1zm38.3-21.4c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.6-1.5-7.6.3-9.1 3.8-1.3 3.6.4 7.7 3.9 9.1zm64.4-5.6c-3.6 1.5-7.8-.2-9.1-3.7-1.5-3.6.2-7.8 3.8-9.2 3.6-1.4 7.7.3 9.2 3.9 1.3 3.5-.4 7.5-3.9 9zm15.9 9.3c-3.6 1.5-7.7-.2-9.1-3.7-1.5-3.6.2-7.8 3.7-9.1 3.6-1.5 7.7.2 9.2 3.8 1.5 3.5-.3 7.5-3.8 9zm4.7 17.7c-3.6 1.5-7.8-.2-9.2-3.8-1.5-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.3 3.5-.4 7.6-3.9 9.1zM89.3 35.8c-3.6 1.5-7.8-.2-9.2-3.8-1.4-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.4 3.6-.3 7.7-3.9 9.1zM69.7 17.7l8.9 4.7V9.3l-8.9 2.8c-.2-.3-.5-.6-.9-.9L72.4 0H59.6l3.5 11.2c-.3.3-.6.5-.9.9l-8.8-2.8v13.1l8.8-4.7c.3.3.6.7.9.9l-5 15.4v.1c-.2.8-.4 1.6-.4 2.4 0 4.1 3.1 7.5 7 8.1h.2c.3 0 .7.1 1 .1.4 0 .7 0 1-.1h.2c4-.6 7.1-4.1 7.1-8.1 0-.8-.1-1.7-.4-2.4V34l-5.1-15.4c.4-.2.7-.6 1-.9zM66 92.8c16.9 0 32.8 1.1 47.1 3.2 4-16.9 8.9-26.7 14-33.5l-9.6-3.4c1 4.9 1.1 7.2 0 10.2-1.5-1.4-3-4.3-4.2-8.7L108.6 76c2.8-2 5-3.2 7.5-3.3-4.4 9.4-10 11.9-13.6 11.2-4.3-.8-6.3-4.6-5.6-7.9 1-4.7 5.7-5.9 8-.5 4.3-8.7-3-11.4-7.6-8.8 7.1-7.2 7.9-13.5 2.1-21.1-8 6.1-8.1 12.3-4.5 20.8-4.7-5.4-12.1-2.5-9.5 6.2 3.4-5.2 7.9-2 7.2 3.1-.6 4.3-6.4 7.8-13.5 7.2-10.3-.9-10.9-8-11.2-13.8 2.5-.5 7.1 1.8 11 7.3L80.2 60c-4.1 4.4-8 5.3-12.3 5.4 1.4-4.4 8-11.6 8-11.6H55.5s6.4 7.2 7.9 11.6c-4.2-.1-8-1-12.3-5.4l1.4 16.4c3.9-5.5 8.5-7.7 10.9-7.3-.3 5.8-.9 12.8-11.1 13.8-7.2.6-12.9-2.9-13.5-7.2-.7-5 3.8-8.3 7.1-3.1 2.7-8.7-4.6-11.6-9.4-6.2 3.7-8.5 3.6-14.7-4.6-20.8-5.8 7.6-5 13.9 2.2 21.1-4.7-2.6-11.9.1-7.7 8.8 2.3-5.5 7.1-4.2 8.1.5.7 3.3-1.3 7.1-5.7 7.9-3.5.7-9-1.8-13.5-11.2 2.5.1 4.7 1.3 7.5 3.3l-4.7-15.4c-1.2 4.4-2.7 7.2-4.3 8.7-1.1-3-.9-5.3 0-10.2l-9.5 3.4c5 6.9 9.9 16.7 14 33.5 14.8-2.1 30.8-3.2 47.7-3.2z"></path>
@@ -185,15 +185,17 @@ en:
185
185
  navigation_search_heading: Search and popular pages
186
186
  navigation_search_subheading: Search
187
187
  popular_links:
188
- - label: 'Coronavirus (COVID-19): guidance'
189
- href: "/guidance/covid-19-coronavirus-restrictions-what-you-can-and-cannot-do"
188
+ - label: 'Coronavirus (COVID-19)'
189
+ href: "/coronavirus"
190
190
  - label: 'Brexit: check what you need to do'
191
191
  href: "/brexit"
192
192
  - label: Sign in to your personal tax account
193
193
  href: "/personal-tax-account"
194
194
  - label: Find a job
195
195
  href: "/find-a-job"
196
- - label: Sign in to your Universal Credit account
196
+ - label: 'Personal tax account: sign in'
197
+ href: "/personal-tax-account"
198
+ - label: 'Universal Credit account: sign in'
197
199
  href: "/sign-in-universal-credit"
198
200
  popular_links_heading: Popular on GOV.UK
199
201
  search_text: Search GOV.UK
@@ -1,7 +1,7 @@
1
1
  module GovukPublishingComponents
2
2
  module Presenters
3
3
  class SinglePageNotificationButtonHelper
4
- attr_reader :already_subscribed, :data_attributes, :base_path, :js_enhancement, :button_type, :button_location
4
+ attr_reader :already_subscribed, :data_attributes, :base_path, :js_enhancement, :button_type, :button_location, :classes
5
5
 
6
6
  def initialize(local_assigns)
7
7
  @local_assigns = local_assigns
@@ -11,6 +11,8 @@ module GovukPublishingComponents
11
11
  @base_path = @local_assigns[:base_path] || nil
12
12
  @button_location = button_location_is_valid? ? @local_assigns[:button_location] : nil
13
13
  @button_type = @local_assigns[:already_subscribed] ? "Unsubscribe" : "Subscribe"
14
+ @classes = %w[gem-c-single-page-notification-button]
15
+ @classes << "js-personalisation-enhancement" if js_enhancement
14
16
  end
15
17
 
16
18
  def data
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "27.17.0".freeze
2
+ VERSION = "27.18.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 27.17.0
4
+ version: 27.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-09 00:00:00.000000000 Z
11
+ date: 2021-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -635,6 +635,7 @@ files:
635
635
  - app/assets/stylesheets/govuk_publishing_components/components/helpers/_markdown-typography.scss
636
636
  - app/assets/stylesheets/govuk_publishing_components/components/mixins/_css3.scss
637
637
  - app/assets/stylesheets/govuk_publishing_components/components/mixins/_govuk-template-link-focus-override.scss
638
+ - app/assets/stylesheets/govuk_publishing_components/components/mixins/_grid-helper.scss
638
639
  - app/assets/stylesheets/govuk_publishing_components/components/mixins/_margins.scss
639
640
  - app/assets/stylesheets/govuk_publishing_components/components/mixins/_media-down.scss
640
641
  - app/assets/stylesheets/govuk_publishing_components/components/mixins/_prefixed-transform.scss