govuk_publishing_components 27.0.0 → 27.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/analytics/auto-scroll-tracker.js +197 -0
  3. data/app/assets/javascripts/govuk_publishing_components/analytics.js +1 -0
  4. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -0
  5. data/app/assets/stylesheets/govuk_publishing_components/components/_big-number.scss +41 -0
  6. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +128 -4
  7. data/app/views/govuk_publishing_components/components/_big_number.html.erb +35 -0
  8. data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +5 -3
  9. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +15 -16
  10. data/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb +5 -5
  11. data/app/views/govuk_publishing_components/components/docs/big_number.yml +56 -0
  12. data/app/views/govuk_publishing_components/components/docs/inverse_header.yml +3 -4
  13. data/app/views/govuk_publishing_components/components/docs/layout_super_navigation_header.yml +5 -0
  14. data/app/views/govuk_publishing_components/components/layout_header/_header_logo.html.erb +5 -2
  15. data/config/locales/ar.yml +40 -0
  16. data/config/locales/az.yml +40 -0
  17. data/config/locales/be.yml +40 -0
  18. data/config/locales/bg.yml +40 -0
  19. data/config/locales/bn.yml +40 -0
  20. data/config/locales/cs.yml +40 -0
  21. data/config/locales/cy.yml +40 -0
  22. data/config/locales/da.yml +40 -0
  23. data/config/locales/de.yml +40 -0
  24. data/config/locales/dr.yml +40 -0
  25. data/config/locales/el.yml +40 -0
  26. data/config/locales/en.yml +8 -3
  27. data/config/locales/es-419.yml +40 -0
  28. data/config/locales/es.yml +40 -0
  29. data/config/locales/et.yml +40 -0
  30. data/config/locales/fa.yml +40 -0
  31. data/config/locales/fi.yml +40 -0
  32. data/config/locales/fr.yml +40 -0
  33. data/config/locales/gd.yml +40 -0
  34. data/config/locales/gu.yml +40 -0
  35. data/config/locales/he.yml +40 -0
  36. data/config/locales/hi.yml +40 -0
  37. data/config/locales/hr.yml +40 -0
  38. data/config/locales/hu.yml +40 -0
  39. data/config/locales/hy.yml +40 -0
  40. data/config/locales/id.yml +40 -0
  41. data/config/locales/is.yml +40 -0
  42. data/config/locales/it.yml +40 -0
  43. data/config/locales/ja.yml +40 -0
  44. data/config/locales/ka.yml +40 -0
  45. data/config/locales/kk.yml +40 -0
  46. data/config/locales/ko.yml +40 -0
  47. data/config/locales/lt.yml +40 -0
  48. data/config/locales/lv.yml +40 -0
  49. data/config/locales/ms.yml +40 -0
  50. data/config/locales/mt.yml +40 -0
  51. data/config/locales/nl.yml +40 -0
  52. data/config/locales/no.yml +40 -0
  53. data/config/locales/pa-pk.yml +40 -0
  54. data/config/locales/pa.yml +40 -0
  55. data/config/locales/pl.yml +40 -0
  56. data/config/locales/ps.yml +40 -0
  57. data/config/locales/pt.yml +40 -0
  58. data/config/locales/ro.yml +40 -0
  59. data/config/locales/ru.yml +40 -0
  60. data/config/locales/si.yml +40 -0
  61. data/config/locales/sk.yml +40 -0
  62. data/config/locales/sl.yml +40 -0
  63. data/config/locales/so.yml +40 -0
  64. data/config/locales/sq.yml +40 -0
  65. data/config/locales/sr.yml +40 -0
  66. data/config/locales/sv.yml +40 -0
  67. data/config/locales/sw.yml +40 -0
  68. data/config/locales/ta.yml +40 -0
  69. data/config/locales/th.yml +40 -0
  70. data/config/locales/tk.yml +40 -0
  71. data/config/locales/tr.yml +40 -0
  72. data/config/locales/uk.yml +40 -0
  73. data/config/locales/ur.yml +40 -0
  74. data/config/locales/uz.yml +40 -0
  75. data/config/locales/vi.yml +40 -0
  76. data/config/locales/zh-hk.yml +40 -0
  77. data/config/locales/zh-tw.yml +40 -0
  78. data/config/locales/zh.yml +40 -0
  79. data/lib/govuk_publishing_components/presenters/devolved_nations_helper.rb +4 -1
  80. data/lib/govuk_publishing_components/version.rb +1 -1
  81. metadata +6 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57832f873fbcb6c9c245858ca1626b8fe4548ee312a96597e0e2ef06ce776ddd
4
- data.tar.gz: ca662dd2ac3a84e232942628613a5e2f36aeab7a5b6b21f4227d727d514ab0ed
3
+ metadata.gz: c72a238dfe33bedb2354586acae39ae707af2543e1147ad399697b7e943161a5
4
+ data.tar.gz: ebe2c25dfbdc7bbd61962a32a4dad734cefb8a9868e232ab7686137a539fa3ad
5
5
  SHA512:
6
- metadata.gz: 73096c4cec16fc95e026911ae54503935ca718b7f0935892412c299f1ed1f5ae7b78db6e555c0256a326126db75673a4027a62840d584bdf185c67bf3c13fda9
7
- data.tar.gz: b482b8fa029539c6c7bc1f196165f75c1d48d8891188cd2fff978b7fdee96cff9a8c74b74736acaa1092caba2a1469b0bbb05743e7dbce567eff433f42fddc60
6
+ metadata.gz: 25b19ea4edc8469f447c053bdeb90cbec595ddab3be836b9ba9c2c7a46d223b1537a19d81aa94313b46f046d8f9f592c55fdc219225d328907abdeb15a48afbc
7
+ data.tar.gz: bf129ecb95da51adabbb82dadef58fca37606b40ea43998f24c1005d30e9ffba6c1c530c866ab1ceb1d5af6b6ba4fccc196f44573b4044a402efd58b1d5505bb
@@ -0,0 +1,197 @@
1
+ window.GOVUK = window.GOVUK || {}
2
+ window.GOVUK.Modules = window.GOVUK.Modules || {};
3
+
4
+ (function (Modules) {
5
+ function AutoScrollTracker ($module) {
6
+ this.$module = $module
7
+ this.pageHeight = document.querySelector('body').clientHeight
8
+ this.trackedNodes = []
9
+ this.config = {
10
+ allowHeadingsInside: ['main'],
11
+ percentages: [20, 40, 60, 80, 100],
12
+ scrollTimeoutDelay: 20,
13
+ resizeTimeoutDelay: 100,
14
+ pageHeightTimeoutDelay: 500
15
+ }
16
+ }
17
+
18
+ AutoScrollTracker.prototype.init = function () {
19
+ var consentCookie = window.GOVUK.getConsentCookie()
20
+
21
+ if (consentCookie && consentCookie.settings) {
22
+ this.startModule()
23
+ } else {
24
+ this.startModule = this.startModule.bind(this)
25
+ window.addEventListener('cookie-consent', this.startModule)
26
+ }
27
+ }
28
+
29
+ AutoScrollTracker.prototype.startModule = function () {
30
+ if (window.GOVUK.analyticsVars.scrollTrackerStarted) {
31
+ return
32
+ }
33
+
34
+ window.GOVUK.analyticsVars.scrollTrackerStarted = true
35
+
36
+ this.trackType = this.$module.getAttribute('data-track-type')
37
+ if (this.trackType === 'headings') {
38
+ this.track = new AutoScrollTracker.Heading(this.config)
39
+ } else {
40
+ this.track = new AutoScrollTracker.Percentage(this.config)
41
+ }
42
+
43
+ this.getWindowDetails()
44
+ // if the URL has a hash we want to prevent tracking on initial page load
45
+ // until the browser jumps down the page, at which point a scroll event
46
+ // will happen and tracking will continue normally
47
+ var windowHash = window.location.hash
48
+ var dontTrackOnLoad = windowHash && document.getElementById(windowHash.substring(1))
49
+ if (!dontTrackOnLoad) {
50
+ this.trackVisibleNodes()
51
+ }
52
+
53
+ if (this.trackedNodes.length) {
54
+ // store event listener functions as variables so they can be removed if needed
55
+ this.scrollEvent = this.onScroll.bind(this)
56
+ window.addEventListener('scroll', this.scrollEvent)
57
+ this.resizeEvent = this.onResize.bind(this)
58
+ window.addEventListener('resize', this.resizeEvent)
59
+
60
+ // check if the page height changes e.g. accordion opened
61
+ this.interval = window.setInterval(function () {
62
+ var pageHeight = document.querySelector('body').clientHeight
63
+ if (pageHeight !== this.pageHeight) {
64
+ this.pageHeight = pageHeight
65
+ this.getWindowDetails()
66
+ this.trackVisibleNodes()
67
+ }
68
+ }.bind(this), this.config.pageHeightTimeoutDelay)
69
+ }
70
+ }
71
+
72
+ AutoScrollTracker.prototype.onScroll = function () {
73
+ clearTimeout(this.scrollTimeout)
74
+ this.scrollTimeout = setTimeout(function () {
75
+ this.trackVisibleNodes()
76
+ }.bind(this), this.config.scrollTimeoutDelay)
77
+ }
78
+
79
+ AutoScrollTracker.prototype.onResize = function () {
80
+ clearTimeout(this.resizeTimeout)
81
+ this.resizeTimeout = setTimeout(function () {
82
+ this.getWindowDetails()
83
+ this.trackVisibleNodes()
84
+ }.bind(this), this.config.resizeTimeoutDelay)
85
+ }
86
+
87
+ AutoScrollTracker.prototype.getWindowDetails = function () {
88
+ this.pageHeight = document.querySelector('body').clientHeight
89
+ this.windowHeight = window.innerHeight
90
+ this.trackedNodes = this.track.getTrackingNodes(this.trackedNodes)
91
+ }
92
+
93
+ AutoScrollTracker.prototype.trackVisibleNodes = function () {
94
+ for (var i = 0; i < this.trackedNodes.length; i++) {
95
+ var node = this.trackedNodes[i]
96
+ if (this.isVisible(node.top, node.bottom) && !node.alreadySeen) {
97
+ node.alreadySeen = true
98
+ // we store whether a heading has been tracked or not on the heading
99
+ // because if headings appear/disapper (e.g. inside an accordion)
100
+ // the order changes, so we can't refer to the previous trackedNodes
101
+ // as we do with percentages
102
+ if (node.node) {
103
+ node.node.setAttribute('data-autoscrolltracker-already-seen', true)
104
+ }
105
+
106
+ var action = node.eventData.action
107
+ var label = node.eventData.label
108
+
109
+ if (window.GOVUK.analytics && window.GOVUK.analytics.trackEvent) {
110
+ window.GOVUK.analytics.trackEvent('ScrollTo', action, { label: label, nonInteraction: true })
111
+ }
112
+ }
113
+ }
114
+ }
115
+
116
+ AutoScrollTracker.prototype.isVisible = function (top, bottom) {
117
+ var scroll = window.scrollY || document.documentElement.scrollTop // IE fallback
118
+ return scroll <= top && (scroll + this.windowHeight) >= bottom
119
+ }
120
+
121
+ AutoScrollTracker.Heading = function (config) {
122
+ this.config = config
123
+ }
124
+
125
+ AutoScrollTracker.Heading.prototype.getTrackingNodes = function () {
126
+ var headingsDetails = []
127
+ var headingsFound = this.findAllowedHeadings()
128
+
129
+ for (var i = 0; i < headingsFound.length; i++) {
130
+ var heading = headingsFound[i]
131
+ // only track headings that are visible i.e. not inside display: none
132
+ if (this.visible(heading)) {
133
+ var pos = heading.getBoundingClientRect()
134
+ headingsDetails.push({
135
+ node: heading,
136
+ alreadySeen: heading.getAttribute('data-autoscrolltracker-already-seen'),
137
+ top: pos.top + document.documentElement.scrollTop,
138
+ bottom: pos.bottom + document.documentElement.scrollTop,
139
+ eventData: { action: 'Heading', label: heading.textContent.replace(/\s+/g, ' ').trim() }
140
+ })
141
+ }
142
+ }
143
+ return headingsDetails
144
+ }
145
+
146
+ // check heading is inside allowed elements, generally ignores everything outside of page content
147
+ AutoScrollTracker.Heading.prototype.findAllowedHeadings = function () {
148
+ var headings = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']
149
+ var headingsFound = []
150
+
151
+ for (var h = 0; h < this.config.allowHeadingsInside.length; h++) {
152
+ var insideElements = document.querySelectorAll(this.config.allowHeadingsInside[h])
153
+ for (var e = 0; e < insideElements.length; e++) {
154
+ var found = insideElements[e].querySelectorAll(headings)
155
+ for (var f = 0; f < found.length; f++) {
156
+ headingsFound.push(found[f])
157
+ }
158
+ }
159
+ }
160
+ return headingsFound
161
+ }
162
+
163
+ // this is bit more verbose than checking offsetParent !== null but more reliable for IE10+
164
+ AutoScrollTracker.Heading.prototype.visible = function (el) {
165
+ return !!(el.offsetWidth || el.offsetHeight || el.getClientRects().length)
166
+ }
167
+
168
+ AutoScrollTracker.Percentage = function (config) {
169
+ this.config = config
170
+ }
171
+
172
+ AutoScrollTracker.Percentage.prototype.getTrackingNodes = function (trackedNodes) {
173
+ var body = document.body
174
+ var html = document.documentElement
175
+ var pageHeight = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight)
176
+
177
+ var percentDetails = []
178
+
179
+ for (var i = 0; i < this.config.percentages.length; i++) {
180
+ var percent = this.config.percentages[i]
181
+ var pos = (pageHeight / 100) * percent
182
+ var alreadySeen = false
183
+ if (trackedNodes.length) {
184
+ alreadySeen = trackedNodes[i].alreadySeen
185
+ }
186
+ percentDetails.push({
187
+ alreadySeen: alreadySeen,
188
+ top: pos,
189
+ bottom: pos,
190
+ eventData: { action: 'Percent', label: String(percent) }
191
+ })
192
+ }
193
+ return percentDetails
194
+ }
195
+
196
+ Modules.AutoScrollTracker = AutoScrollTracker
197
+ })(window.GOVUK.Modules)
@@ -14,6 +14,7 @@
14
14
  //= require ./analytics/ecommerce
15
15
  //= require ./analytics/init
16
16
  //= require ./analytics/scroll-tracker
17
+ //= require ./analytics/auto-scroll-tracker
17
18
  //= require ./analytics/explicit-cross-domain-links
18
19
  //= require ./analytics/track-click
19
20
  //= require ./analytics/track-select-change
@@ -16,6 +16,7 @@ $govuk-new-link-styles: true;
16
16
  @import "components/attachment";
17
17
  @import "components/attachment-link";
18
18
  @import "components/back-link";
19
+ @import "components/big-number";
19
20
  @import "components/breadcrumbs";
20
21
  @import "components/button";
21
22
  @import "components/character-count";
@@ -0,0 +1,41 @@
1
+ .gem-c-big-number {
2
+ margin-bottom: govuk-spacing(3);
3
+ }
4
+
5
+ .gem-c-big-number__value {
6
+ @include govuk-font($size: 80, $weight: bold);
7
+ }
8
+
9
+ .gem-c-big-number__label {
10
+ @include govuk-font($size: 16, $weight: bold, $line-height: 2);
11
+
12
+ // This pseudo element is to bypass an issue with NVDA where block level elements are dictated separately.
13
+ // What's happening here is that the label and the number technically have an inline relationship but appear to have a block relationship thanks to this element
14
+ &:before {
15
+ content: "";
16
+ display: block;
17
+ }
18
+ }
19
+
20
+ .gem-c-big-number__link {
21
+ display: inline-block;
22
+ text-decoration: none;
23
+
24
+ // Add govuk-link hover decoration to main value if no label present but a href attribute is
25
+ .gem-c-big-number__value--decorated {
26
+ @include govuk-link-decoration;
27
+ @include govuk-link-style-no-underline;
28
+ }
29
+
30
+ .gem-c-big-number__label {
31
+ @include govuk-link-decoration;
32
+ }
33
+
34
+ &:hover,
35
+ &:active {
36
+ .gem-c-big-number__label,
37
+ .gem-c-big-number__value--decorated {
38
+ @include govuk-link-hover-decoration;
39
+ }
40
+ }
41
+ }
@@ -1,3 +1,97 @@
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 vertical columns
23
+ ///
24
+ /// @param {Integer} $items - number of items that need to be arranged
25
+ /// @param {Integer} $columns - number of columns required
26
+ /// @param {String} $selector - (optional) the inner element to be targeted.
27
+ ///
28
+ /// @example scss - A 7 item 2 column layout.
29
+ /// .container {
30
+ /// @include columns(7, 2);
31
+ /// }
32
+
33
+ /// @example scss - A 9 item 3 column layout that has `div`s as the inner
34
+ /// elements.
35
+ /// .container {
36
+ /// @include columns(9, 3, "div");
37
+ /// }
38
+ ///
39
+ @mixin columns($items, $columns, $selector: "*") {
40
+ $rows: ceil($items / $columns);
41
+
42
+ display: -ms-grid;
43
+ display: grid;
44
+ grid-auto-flow: column;
45
+ -ms-grid-columns: fractions($columns);
46
+ grid-template-columns: fractions($columns);
47
+ -ms-grid-rows: fractions($rows);
48
+ grid-template-rows: fractions($rows);
49
+
50
+ // Internet Explorer 10-11 require each element to be placed in the grid -
51
+ // the `grid-auto-flow` property isn't supported. This means that both the
52
+ // column and row needs to be set for every element.
53
+
54
+ // This creates a list of lists to represent the columns and rows; for
55
+ // example, a 7 item 2 column list would create this:
56
+ // [
57
+ // [1, 2, 3, 4 ] // column one
58
+ // [5, 6, 7] // column two
59
+ // ]
60
+ $grid: ();
61
+ $counter: 0;
62
+
63
+ @for $column from 1 through $columns {
64
+ $this-row: ();
65
+
66
+ @for $row from 1 through $rows {
67
+ $counter: $counter + 1;
68
+
69
+ @if $counter <= $items {
70
+ $this-row: append($this-row, $counter);
71
+ }
72
+ }
73
+
74
+ $grid: append($grid, $this-row, "comma");
75
+ }
76
+
77
+ // Now we can loop through the list of lists to create the rules needed for
78
+ // the older grid syntax; fist looping through the list to get the number
79
+ // needed for the column, then looping again to get the number for the grid
80
+ // row:
81
+ @for $column_index from 1 through length($grid) {
82
+ $this-row: nth($grid, $column_index);
83
+
84
+ @for $item-index from 1 through length($this-row) {
85
+ $this-item: nth($this-row, $item-index);
86
+
87
+ & > #{$selector}:nth-child(#{$this-item}) {
88
+ -ms-grid-column: $column_index;
89
+ -ms-grid-row: $item-index;
90
+ }
91
+ }
92
+ }
93
+ }
94
+
1
95
  $search-icon-size: 20px;
2
96
 
3
97
  @mixin chevron($colour) {
@@ -431,6 +525,26 @@ $search-icon-size: 20px;
431
525
  content: " ";
432
526
  }
433
527
  }
528
+
529
+ // To avoid the 'sticky hover' problem, we need to stop the hover state on
530
+ // touch screen devices.
531
+ //
532
+ // One solution is to use `@media(hover: hover)`. This turns on the hover
533
+ // state only for devices that aren't touchscreen, but means that browsers
534
+ // that don't support this media query won't get a hover state at all.
535
+ //
536
+ // To get around this, we do the opposite - we turn off the hover state for
537
+ // for touchscreen devices.
538
+ @media (hover: none), (pointer: coarse) {
539
+ &:not(:focus):hover {
540
+ background-color: $govuk-link-colour;
541
+ color: govuk-colour("white");
542
+
543
+ &:after {
544
+ background-color: $govuk-link-colour;
545
+ }
546
+ }
547
+ }
434
548
  }
435
549
  }
436
550
 
@@ -579,8 +693,6 @@ $search-icon-size: 20px;
579
693
  padding: govuk-spacing(2) 0 govuk-spacing(6) 0;
580
694
 
581
695
  @include govuk-media-query($from: "desktop") {
582
- display: flex;
583
- flex-wrap: wrap;
584
696
  margin-left: (0 - govuk-spacing(3));
585
697
  margin-right: (0 - govuk-spacing(3));
586
698
  padding: govuk-spacing(6) 0 govuk-spacing(8) 0;
@@ -590,11 +702,23 @@ $search-icon-size: 20px;
590
702
  margin-bottom: 0;
591
703
  padding-left: govuk-spacing(3);
592
704
  padding-right: govuk-spacing(3);
593
- width: 50%;
594
705
  }
595
706
  }
596
707
  }
597
708
 
709
+ .gem-c-layout-super-navigation-header__navigation-second-items--topics {
710
+ @include govuk-media-query($from: "desktop") {
711
+ @include columns(18, 2, "li");
712
+ }
713
+ }
714
+
715
+ .gem-c-layout-super-navigation-header__navigation-second-items--government-activity {
716
+ @include govuk-media-query($from: "desktop") {
717
+ @include columns(5, 2, "li");
718
+ padding-bottom: govuk-spacing(3);
719
+ }
720
+ }
721
+
598
722
  .gem-c-layout-super-navigation-header__navigation-second-item-link {
599
723
  display: inline-block;
600
724
  padding: govuk-spacing(2) 0;
@@ -608,8 +732,8 @@ $search-icon-size: 20px;
608
732
 
609
733
  .gem-c-layout-super-navigation-header__navigation-second-item-link--with-description {
610
734
  @include govuk-font($size: 19, $weight: bold);
735
+ margin-top: govuk-spacing(2);
611
736
  margin-bottom: 0;
612
- padding-bottom: govuk-spacing(1);
613
737
  }
614
738
 
615
739
  // Dropdown menu footer links.
@@ -0,0 +1,35 @@
1
+ <%
2
+ href ||= nil
3
+ number ||= nil
4
+ label ||= nil
5
+ href ||= nil
6
+ data_attributes ||= nil
7
+ classes = ["gem-c-big-number__value"]
8
+
9
+ if label.nil? && href
10
+ classes << "gem-c-big-number__value--decorated"
11
+ end
12
+ %>
13
+ <% if number %>
14
+ <% big_number_value = capture do %>
15
+ <%= tag.span class: classes, data: href ? nil : data_attributes do %>
16
+ <%= number %>
17
+ <% end %>
18
+
19
+ <% unless label.nil? %>
20
+ <% # add a virtual space here to handle screen readers printing dictations without a space between the number and the label %>
21
+ <span class="govuk-visually-hidden">&nbsp;</span>
22
+ <span class="gem-c-big-number__label">
23
+ <%= label %>
24
+ </span>
25
+ <% end %>
26
+ <% end %>
27
+
28
+ <%= tag.div class: "gem-c-big-number" do %>
29
+ <% unless href.nil? %>
30
+ <%= link_to big_number_value, href, class: "govuk-link gem-c-big-number__link", data: data_attributes %>
31
+ <% else %>
32
+ <%= big_number_value %>
33
+ <% end %>
34
+ <% end %>
35
+ <% end %>
@@ -44,8 +44,8 @@
44
44
  body_css_classes << "draft" if draft_watermark
45
45
  -%>
46
46
  <!DOCTYPE html>
47
- <!--[if lt IE 9]><html class="lte-ie8" lang="<%= html_lang %>"><![endif]-->
48
- <!--[if gt IE 8]><!--><html lang="<%= html_lang %>"><!--<![endif]-->
47
+ <!--[if lt IE 9]><html class="lte-ie8 govuk-template" lang="<%= html_lang %>"><![endif]-->
48
+ <!--[if gt IE 8]><!--><html class="govuk-template" lang="<%= html_lang %>"><!--<![endif]-->
49
49
  <head>
50
50
  <meta charset="utf-8" />
51
51
  <title><%= title %></title>
@@ -87,7 +87,9 @@
87
87
 
88
88
  <% unless omit_header %>
89
89
  <% if show_explore_header %>
90
- <%= render "govuk_publishing_components/components/layout_super_navigation_header" %>
90
+ <%= render "govuk_publishing_components/components/layout_super_navigation_header", {
91
+ logo_link: logo_link,
92
+ } %>
91
93
  <% else %>
92
94
  <%= render "govuk_publishing_components/components/layout_header", {
93
95
  search: show_search,
@@ -1,20 +1,19 @@
1
1
  <%
2
- logo_link = "https://www.gov.uk/"
3
- logo_link_title = t("components.layout_super_navigation_header.logo_link_title")
4
- logo_text = t("components.layout_super_navigation_header.logo_text")
5
- navigation_links = t("components.layout_super_navigation_header.navigation_links")
6
- navigation_menu_heading = t("components.layout_super_navigation_header.navigation_menu_heading")
7
- navigation_search_heading = t("components.layout_super_navigation_header.navigation_search_heading")
8
- navigation_search_subheading = t("components.layout_super_navigation_header.navigation_search_subheading")
9
- popular_links = t("components.layout_super_navigation_header.popular_links")
10
- popular_links_heading = t("components.layout_super_navigation_header.popular_links_heading")
11
- search_text = t("components.layout_super_navigation_header.search_text")
12
-
13
- hide_search_menu_text = t("components.layout_super_navigation_header.menu_toggle_label.hide", :label => "search")
14
- show_search_menu_text = t("components.layout_super_navigation_header.menu_toggle_label.show", :label => "search")
15
- hide_navigation_menu_text = t("components.layout_super_navigation_header.menu_toggle_label.hide", :label => "navigation")
16
- show_navigation_menu_text = t("components.layout_super_navigation_header.menu_toggle_label.show", :label => "navigation")
2
+ logo_link ||= "https://www.gov.uk/"
3
+ logo_link_title ||= t("components.layout_super_navigation_header.logo_link_title")
4
+ logo_text = t("components.layout_super_navigation_header.logo_text")
5
+ navigation_links = t("components.layout_super_navigation_header.navigation_links")
6
+ navigation_menu_heading = t("components.layout_super_navigation_header.navigation_menu_heading")
7
+ navigation_search_heading = t("components.layout_super_navigation_header.navigation_search_heading")
8
+ navigation_search_subheading = t("components.layout_super_navigation_header.navigation_search_subheading")
9
+ popular_links = t("components.layout_super_navigation_header.popular_links")
10
+ popular_links_heading = t("components.layout_super_navigation_header.popular_links_heading")
11
+ search_text = t("components.layout_super_navigation_header.search_text")
17
12
 
13
+ hide_search_menu_text = t("components.layout_super_navigation_header.menu_toggle_label.hide", :label => "search")
14
+ show_search_menu_text = t("components.layout_super_navigation_header.menu_toggle_label.show", :label => "search")
15
+ hide_navigation_menu_text = t("components.layout_super_navigation_header.menu_toggle_label.hide", :label => "navigation")
16
+ show_navigation_menu_text = t("components.layout_super_navigation_header.menu_toggle_label.show", :label => "navigation")
18
17
  %>
19
18
  <header role="banner" class="gem-c-layout-super-navigation-header">
20
19
  <div class="gem-c-layout-super-navigation-header__container govuk-width-container govuk-clearfix">
@@ -134,7 +133,7 @@ show_navigation_menu_text = t("components.layout_super_navigation_header.menu_to
134
133
  </div>
135
134
  <% if link[:menu_contents].present? %>
136
135
  <div class="govuk-grid-column-two-thirds-from-desktop">
137
- <ul class="govuk-list gem-c-layout-super-navigation-header__navigation-second-items">
136
+ <ul class="govuk-list gem-c-layout-super-navigation-header__navigation-second-items gem-c-layout-super-navigation-header__navigation-second-items--<%= link[:label].parameterize %>">
138
137
  <% link[:menu_contents].each do | item | %>
139
138
  <%
140
139
  has_description = item[:description].present?
@@ -19,17 +19,17 @@
19
19
  tracking_options ||= ({ dimension96: tracking_id }).to_json
20
20
  end
21
21
 
22
- local_assigns[:margin_bottom] ||= 0
23
22
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
24
- classes = "gem-c-step-nav-header #{shared_helper.get_margin_bottom}"
23
+ classes = %w(gem-c-step-nav-header)
24
+ classes << shared_helper.get_margin_bottom if local_assigns[:margin_bottom]
25
25
  %>
26
26
  <% if title %>
27
27
  <script type="application/ld+json">
28
28
  <%= raw JSON.pretty_generate(breadcrumb_presenter.structured_data) %>
29
29
  </script>
30
30
 
31
- <h2 class="<%= classes %>" data-module="gem-track-click">
32
- <span class="gem-c-step-nav-header__part-of">Part of</span>
31
+ <%= tag.div class: classes, data: { module: "gem-track-click" } do %>
32
+ <strong class="gem-c-step-nav-header__part-of">Part of</strong>
33
33
  <% if path %>
34
34
  <a href="<%= path %>"
35
35
  class="gem-c-step-nav-header__title govuk-link"
@@ -51,5 +51,5 @@
51
51
  <%= title %>
52
52
  </span>
53
53
  <% end %>
54
- </h2>
54
+ <% end %>
55
55
  <% end %>
@@ -0,0 +1,56 @@
1
+ name: Big number
2
+ description: A big number, with a label if needed, for visualising quantitative values such as the number of government departments or historical prime ministers.
3
+ body: |
4
+ This component requires at least a non-falsey `number` attribute value passed to it, otherwise it will not render.
5
+ accessibility_criteria: |
6
+ This component must:
7
+
8
+ - communicate number value and label (if present) in a single dictation when read with a screen reader
9
+ - convey the meaning of the number shown
10
+ shared_accessibility_criteria:
11
+ - link
12
+ examples:
13
+ default:
14
+ data:
15
+ number: 119
16
+ with_labels:
17
+ description: Labels for numbers are given inline styling but stacked using pseudo elements with display block. This is to bypass an issue with NVDA where block level elements are dictated separately.
18
+ data:
19
+ number: 119
20
+ label: Open consultations
21
+ passing_extra_symbols:
22
+ description: "In some cases, we want to communicate more than just the flat numeric value eg: 400+, 90%, -20, 1M etc. This is why we allow values to be passed as flat strings."
23
+ data:
24
+ number: "400+"
25
+ label: Other agencies and public bodies
26
+ with_link:
27
+ data:
28
+ number: 23
29
+ label: Ministerial departments
30
+ href: "/government/organisations#ministerial_departments"
31
+ with_link_but_no_label:
32
+ description: Numbers that are links are underlined unless a label is provided, in which case the label is given the underline.
33
+ data:
34
+ number: 23
35
+ href: "/government/organisations#ministerial_departments"
36
+ with_data_attributes:
37
+ description: |
38
+ If a `href` attribute is present, data attributes will apply to the `span` containing the number value (see below).
39
+
40
+ This will also not automatically apply a `gem-track-click` module attribute if the data attributes pertain to click tracking. Remember to apply this outside the component call in a surrounding element, if using.
41
+ data:
42
+ number: 23
43
+ label: Ministerial departments
44
+ href: "/government/organisations#ministerial_departments"
45
+ data_attributes:
46
+ track-category: homepageClicked
47
+ track-action: departmentsLink
48
+ track-label: "/government/organisations#ministerial_departments"
49
+ track-dimension: 23 Ministerial departments
50
+ track-dimension-index: 29
51
+ with_data_attributes_but_no_link:
52
+ data:
53
+ number: 23
54
+ label: Ministerial departments
55
+ data_attributes:
56
+ department-count: true
@@ -1,15 +1,14 @@
1
1
  name: Inverse header
2
2
  description: A wrapper to contain header content in white text
3
3
  body: |
4
- This component can be passed a block of template code and will wrap it in a blue header. This is as light-touch as possible and doesn't attempt to deal with the margins and paddings of its content. White text is enforced on content and would need to be overriden where unwanted. Implemented to accomodate topic and list page headings and breadcrumbs but unopinionated about its contents.
4
+ This component can be passed a block of template code and will wrap it in a blue header. This is as light-touch as possible and doesn't attempt to deal with the margins and paddings of its content. White text is enforced on content and would need to be overridden where unwanted. Implemented to accommodate topic and list page headings and breadcrumbs but unopinionated about its contents.
5
5
 
6
6
  If passing links to the block make sure to add [the inverse modifier](https://design-system.service.gov.uk/styles/typography/#links-on-dark-backgrounds).
7
7
 
8
8
  accessibility_criteria: |
9
9
  The component must:
10
10
 
11
- * be used in conjunction with content that renders a text contrast ratio higher than 4.5:1
12
- against the header colour to meet WCAG AA.
11
+ * be used in conjunction with content that renders a text contrast ratio higher than 4.5:1 against the header colour to meet WCAG AA.
13
12
 
14
13
  accessibility_excluded_rules:
15
14
  - skip-link # Examples of this component contain breadcrumbs, creating a reference to #content which is part of the layout
@@ -33,7 +32,7 @@ examples:
33
32
  </h1>
34
33
  </div>
35
34
  html_publication_header:
36
- description: "The inverse header component is used on HTMl publications. [See example on GOV.UK here](https://www.gov.uk/government/publications/ln5-0at-jackson-homes-scopwick-ltd-environmental-permit-application-advertisement/ln5-0at-jackson-homes-scopwick-ltd-environmental-permit-application)"
35
+ description: "The inverse header component is used on HTML publications. [See example on GOV.UK here](https://www.gov.uk/government/publications/ln5-0at-jackson-homes-scopwick-ltd-environmental-permit-application-advertisement/ln5-0at-jackson-homes-scopwick-ltd-environmental-permit-application)"
37
36
  data:
38
37
  block: |
39
38
  <div class="gem-c-title gem-c-title--inverse gem-c-title--bottom-margin">
@@ -20,3 +20,8 @@ accessibility_excluded_rules:
20
20
  - landmark-no-duplicate-banner # banners will be duplicated in component examples list
21
21
  examples:
22
22
  default:
23
+ with_custom_logo_link:
24
+ description: The header logo links to root by default. This option allows us to override that in certain instances. Remember to change the title, as the default is "Go to the GOV.UK homepage".
25
+ data:
26
+ logo_link: "https://www.example.com"
27
+ logo_link_title: "Go to example"