govuk_publishing_components 25.1.0 → 25.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/components/layout-super-navigation-header.js +234 -40
  3. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js +6 -0
  4. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +606 -41
  5. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_charts.scss +5 -0
  6. data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +1 -1
  7. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +275 -65
  8. data/config/locales/ar.yml +5 -3
  9. data/config/locales/az.yml +5 -3
  10. data/config/locales/be.yml +5 -3
  11. data/config/locales/bg.yml +5 -3
  12. data/config/locales/bn.yml +5 -3
  13. data/config/locales/cs.yml +5 -3
  14. data/config/locales/cy.yml +8 -6
  15. data/config/locales/da.yml +5 -3
  16. data/config/locales/de.yml +5 -3
  17. data/config/locales/dr.yml +5 -3
  18. data/config/locales/el.yml +5 -3
  19. data/config/locales/en.yml +87 -83
  20. data/config/locales/es-419.yml +5 -3
  21. data/config/locales/es.yml +5 -3
  22. data/config/locales/et.yml +5 -3
  23. data/config/locales/fa.yml +5 -3
  24. data/config/locales/fi.yml +5 -3
  25. data/config/locales/fr.yml +5 -3
  26. data/config/locales/gd.yml +5 -3
  27. data/config/locales/gu.yml +5 -3
  28. data/config/locales/he.yml +5 -3
  29. data/config/locales/hi.yml +5 -3
  30. data/config/locales/hr.yml +5 -3
  31. data/config/locales/hu.yml +5 -3
  32. data/config/locales/hy.yml +5 -3
  33. data/config/locales/id.yml +5 -3
  34. data/config/locales/is.yml +5 -3
  35. data/config/locales/it.yml +5 -3
  36. data/config/locales/ja.yml +5 -3
  37. data/config/locales/ka.yml +5 -3
  38. data/config/locales/kk.yml +5 -3
  39. data/config/locales/ko.yml +5 -3
  40. data/config/locales/lt.yml +5 -3
  41. data/config/locales/lv.yml +5 -3
  42. data/config/locales/ms.yml +5 -3
  43. data/config/locales/mt.yml +5 -3
  44. data/config/locales/nl.yml +5 -3
  45. data/config/locales/no.yml +5 -3
  46. data/config/locales/pa-pk.yml +5 -3
  47. data/config/locales/pa.yml +5 -3
  48. data/config/locales/pl.yml +5 -3
  49. data/config/locales/ps.yml +5 -3
  50. data/config/locales/pt.yml +5 -3
  51. data/config/locales/ro.yml +5 -3
  52. data/config/locales/ru.yml +5 -3
  53. data/config/locales/si.yml +5 -3
  54. data/config/locales/sk.yml +5 -3
  55. data/config/locales/sl.yml +5 -3
  56. data/config/locales/so.yml +5 -3
  57. data/config/locales/sq.yml +5 -3
  58. data/config/locales/sr.yml +5 -3
  59. data/config/locales/sv.yml +5 -3
  60. data/config/locales/sw.yml +5 -3
  61. data/config/locales/ta.yml +5 -3
  62. data/config/locales/th.yml +5 -3
  63. data/config/locales/tk.yml +5 -3
  64. data/config/locales/tr.yml +5 -3
  65. data/config/locales/uk.yml +5 -3
  66. data/config/locales/ur.yml +5 -3
  67. data/config/locales/uz.yml +5 -3
  68. data/config/locales/vi.yml +5 -3
  69. data/config/locales/zh-hk.yml +5 -3
  70. data/config/locales/zh-tw.yml +5 -3
  71. data/config/locales/zh.yml +5 -3
  72. data/lib/govuk_publishing_components/version.rb +1 -1
  73. metadata +2 -2
@@ -279,6 +279,11 @@
279
279
  padding: govuk-spacing(2);
280
280
  background-color: govuk-colour("white");
281
281
 
282
+ &:hover {
283
+ background-color: govuk-colour("light-grey");
284
+ color: $govuk-link-hover-colour;
285
+ }
286
+
282
287
  &:focus {
283
288
  @include govuk-focused-text;
284
289
  background-color: $govuk-focus-colour;
@@ -17,7 +17,7 @@
17
17
  # This is a hack - but it's the only way I can find to not have two blue bars on
18
18
  # constrained width layouts.
19
19
  #
20
- # The full width layout hides the blue bar underneath the blar header bar - so
20
+ # The full width layout hides the blue bar underneath the black header bar - so
21
21
  # full width pages won't see the blue bar unless it's added by another component
22
22
  # - and for most pages that component is the global banner.
23
23
  #
@@ -4,17 +4,28 @@ logo_link_title = t("components.layout_super_navigation_header.logo_link_title")
4
4
  logo_text = t("components.layout_super_navigation_header.logo_text")
5
5
  navigation_links = t("components.layout_super_navigation_header.navigation_links")
6
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")
7
9
  popular_links = t("components.layout_super_navigation_header.popular_links")
8
10
  popular_links_heading = t("components.layout_super_navigation_header.popular_links_heading")
9
- search_text= t("components.layout_super_navigation_header.search_text")
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")
17
+
10
18
  %>
11
19
  <header role="banner" class="gem-c-layout-super-navigation-header">
12
20
  <div class="gem-c-layout-super-navigation-header__container govuk-width-container govuk-clearfix">
13
21
  <div class="gem-c-layout-super-navigation-header__header-logo">
14
22
  <a class="govuk-header__link govuk-header__link--homepage"
15
23
  data-module="gem-track-click"
16
- data-track-action="homeHeader"
17
- data-track-category="homeLinkClicked"
24
+ data-track-action="logoLink"
25
+ data-track-category="headerClicked"
26
+ data-track-label="<%= logo_link %>"
27
+ data-track-dimension="<%= logo_text %>"
28
+ data-track-dimension-index="29"
18
29
  href="<%= logo_link %>"
19
30
  id="logo"
20
31
  title="<%= logo_link_title %>">
@@ -46,76 +57,275 @@ search_text= t("components.layout_super_navigation_header.search_text")
46
57
  <nav
47
58
  aria-labelledby="super-navigation-menu-heading"
48
59
  class="gem-c-layout-super-navigation-header__content"
49
- data-module="super-navigation-toggle"
50
- data-text-for-button="Menu"
51
- data-text-for-show-menu="Show navigation menu"
52
- data-text-for-hide-menu="Hide navigation menu"
60
+ data-module="super-navigation-mega-menu"
53
61
  >
54
- <h2 id="super-navigation-menu-heading" class="govuk-visually-hidden"><%= navigation_menu_heading %></h2>
55
- <ul id="super-navigation-menu" class="gem-c-layout-super-navigation-header__items">
56
- <% navigation_links.each do | link | %>
57
- <li class="govuk-header__navigation-item gem-c-layout-super-navigation-header__item">
58
- <a class="govuk-header__link gem-c-layout-super-navigation-header__item-link" href="<%= link[:href] %>">
59
- <%= link[:label] %>
60
- </a>
61
- <% if link[:menu_contents].present? or link[:footer_links].present? %>
62
- <div class="gem-c-layout-super-navigation-header__dropdown-menu">
63
- <% if link[:menu_contents].present? %>
64
- <ul class="govuk-list">
65
- <% link[:menu_contents].each do | item | %>
66
- <li class="gem-c-layout-super-navigation-header__dropdown-list-item">
67
- <a class="govuk-link gem-c-layout-super-navigation-header__dropdown-list-item-link" href="<%= item[:href] %>">
68
- <%= item[:label] %>
69
- </a>
70
- <%= tag.p item[:description], class: "govuk-body-s gem-c-layout-super-navigation-header__dropdown-list-item-description" if item[:description].present? %>
71
- </li>
62
+ <h2 id="super-navigation-menu-heading" class="govuk-visually-hidden">
63
+ <%= navigation_menu_heading %>
64
+ </h2>
65
+ <button
66
+ aria-controls="super-navigation-menu"
67
+ aria-expanded="true"
68
+ aria-label="<%= hide_navigation_menu_text %>"
69
+ class="gem-c-layout-super-navigation-header__navigation-top-toggle-button"
70
+ data-text-for-hide="<%= hide_navigation_menu_text %>"
71
+ data-text-for-show="<%= show_navigation_menu_text %>"
72
+ data-toggle-desktop-group="hidden"
73
+ data-toggle-mobile-group="top"
74
+ data-tracking-key="menu"
75
+ hidden
76
+ id="super-navigation-menu-toggle"
77
+ type="button"
78
+ >
79
+ Menu
80
+ </button>
81
+ <ul id="super-navigation-menu" class="gem-c-layout-super-navigation-header__navigation-items">
82
+ <% navigation_links.each_with_index do | link, index | %>
83
+ <%
84
+ has_children = (link[:menu_contents].present? or link[:footer_links].present?)
85
+ li_classes = %w[gem-c-layout-super-navigation-header__navigation-item]
86
+ li_classes << "gem-c-layout-super-navigation-header__navigation-item--with-children" if has_children
87
+ unique_id = SecureRandom.hex(4)
88
+ show_menu_text = t("components.layout_super_navigation_header.menu_toggle_label.show", :label => link[:label])
89
+ hide_menu_text = t("components.layout_super_navigation_header.menu_toggle_label.hide", :label => link[:label])
90
+ tracking_label = link[:label].downcase.gsub(/\s+/, "")
91
+ %>
92
+ <%= tag.li class: li_classes do %>
93
+ <%= link_to link[:label], link[:href], {
94
+ class: "gem-c-layout-super-navigation-header__navigation-item-link",
95
+ data: {
96
+ module: "gem-track-click",
97
+ track_action: "#{tracking_label}Link",
98
+ track_category: "headerClicked",
99
+ track_label: link[:href],
100
+ track_dimension: link[:label],
101
+ track_dimension_index: "29",
102
+ }
103
+ } %>
104
+ <% if has_children %>
105
+ <button
106
+ aria-controls="super-navigation-menu__section-<%= unique_id %>"
107
+ aria-expanded="false"
108
+ aria-label="<%= show_menu_text %>"
109
+ class="gem-c-layout-super-navigation-header__navigation-second-toggle-button"
110
+ data-text-for-hide="<%= hide_menu_text %>"
111
+ data-text-for-show="<%= show_menu_text %>"
112
+ data-toggle-desktop-group="top"
113
+ data-toggle-mobile-group="second"
114
+ data-tracking-key="<%= tracking_label %>"
115
+ hidden
116
+ id="super-navigation-menu__section-<%= unique_id %>-toggle"
117
+ type="button"
118
+ >
119
+ <%= link[:label] %>
120
+ </button>
121
+ <div
122
+ hidden
123
+ class="gem-c-layout-super-navigation-header__navigation-dropdown-menu"
124
+ id="super-navigation-menu__section-<%= unique_id %>"
125
+ >
126
+ <div class="govuk-width-container">
127
+ <div class="govuk-grid-row">
128
+ <div class="govuk-grid-column-one-third-from-desktop">
129
+ <% if link[:description].present? %>
130
+ <p class="govuk-body-l gem-c-layout-super-navigation-header__menu-description">
131
+ <%= link[:description] %>
132
+ </p>
133
+ <% end %>
134
+ </div>
135
+ <% if link[:menu_contents].present? %>
136
+ <div class="govuk-grid-column-two-thirds-from-desktop">
137
+ <ul class="govuk-list gem-c-layout-super-navigation-header__navigation-second-items">
138
+ <% link[:menu_contents].each do | item | %>
139
+ <%
140
+ has_description = item[:description].present?
141
+ link_classes = %w[govuk-link gem-c-layout-super-navigation-header__navigation-second-item-link]
142
+ link_classes << "gem-c-layout-super-navigation-header__navigation-second-item-link--with-description" if has_description
143
+ %>
144
+ <li class="gem-c-layout-super-navigation-header__dropdown-list-item">
145
+ <%= link_to item[:label], item[:href], {
146
+ class: link_classes,
147
+ data: {
148
+ module: "gem-track-click",
149
+ track_action: "#{tracking_label}Link",
150
+ track_category: "headerClicked",
151
+ track_label: item[:href],
152
+ track_dimension: item[:label],
153
+ track_dimension_index: "29",
154
+ }
155
+ } %>
156
+ <%= tag.p item[:description], class: "govuk-body govuk-!-margin-0" if has_description %>
157
+ </li>
158
+ <% end %>
159
+ </ul>
160
+ </div>
72
161
  <% end %>
73
- </ul>
74
- <% end %>
75
- <% if link[:footer_links].present? %>
76
- <ul class="govuk-list">
77
- <% link[:footer_links].each do | item | %>
78
- <li class="gem-c-layout-super-navigation-header__dropdown-list-item">
79
- <a class="govuk-link gem-c-layout-super-navigation-header__dropdown-list-item-link" href="<%= item[:href] %>">
80
- <%= item[:label] %>
81
- </a>
82
- </li>
83
- <% end %>
84
- </ul>
85
- <% end %>
162
+ </div>
163
+ <% if link[:footer_links].present? %>
164
+ <div class="govuk-grid-row">
165
+ <div class="govuk-grid-column-full">
166
+ <div class="gem-c-layout-super-navigation-header__navigation-second-footer">
167
+ <div class="govuk-grid-row">
168
+ <ul class="gem-c-layout-super-navigation-header__navigation-second-footer-list">
169
+ <% link[:footer_links].each do | item | %>
170
+ <li class="gem-c-layout-super-navigation-header__navigation-second-footer-item">
171
+ <%= link_to item[:label], item[:href], {
172
+ class: [
173
+ "govuk-link",
174
+ "gem-c-layout-super-navigation-header__navigation-second-footer-link",
175
+ ],
176
+ data: {
177
+ module: "gem-track-click",
178
+ track_action: "#{tracking_label}Link",
179
+ track_category: "headerClicked",
180
+ track_label: item[:href],
181
+ track_dimension: item[:label],
182
+ track_dimension_index: "29",
183
+ }
184
+ } %>
185
+ </li>
186
+ <% end %>
187
+ </ul>
188
+ </div>
189
+ </div>
190
+ </div>
191
+ </div>
192
+ <% end %>
193
+ </div>
86
194
  </div>
87
195
  <% end %>
88
- </li>
196
+ <% end %>
89
197
  <% end %>
90
- <li class="govuk-header__navigation-item gem-c-layout-super-navigation-header__item gem-c-layout-super-navigation-header__item--search">
91
- <a class="govuk-header__link gem-c-layout-super-navigation-header__item-link gem-c-layout-super-navigation-header__item-link--search" href="/search">
92
- <span class="gem-c-layout-super-navigation-header__item-link-text--search"><%= search_text %></span>
93
- <svg class="gem-c-layout-super-navigation-header__item-link-icon--search" width="27" height="27" viewBox="0 0 27 27" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
94
- <circle cx="10.0161" cy="10.0161" r="8.51613" stroke="currentColor" stroke-width="3" />
95
- <line x1="15.8668" y1="16.3587" x2="25.4475" y2="25.9393" stroke="currentColor" stroke-width="3" />
198
+ </ul>
199
+
200
+ <button
201
+ aria-controls="super-search-menu"
202
+ aria-expanded="true"
203
+ aria-label="<%= hide_search_menu_text %>"
204
+ class="gem-c-layout-super-navigation-header__search-toggle-button"
205
+ data-text-for-hide="<%= hide_search_menu_text %>"
206
+ data-text-for-show="<%= show_search_menu_text %>"
207
+ data-toggle-mobile-group="top"
208
+ data-toggle-desktop-group="top"
209
+ data-tracking-key="search"
210
+ hidden
211
+ id="super-search-menu-toggle"
212
+ type="button"
213
+ >
214
+ <span class="govuk-visually-hidden">
215
+ <%= search_text %>
216
+ </span>
217
+ <svg
218
+ class="gem-c-layout-super-navigation-header__search-toggle-button-link-icon"
219
+ width="27"
220
+ height="27"
221
+ viewBox="0 0 27 27"
222
+ fill="none"
223
+ xmlns="http://www.w3.org/2000/svg"
224
+ aria-hidden="true"
225
+ focusable="false"
226
+ >
227
+ <circle
228
+ cx="10.0161"
229
+ cy="10.0161"
230
+ r="8.51613"
231
+ stroke="currentColor"
232
+ stroke-width="3" />
233
+ <line
234
+ x1="15.8668"
235
+ y1="16.3587"
236
+ x2="25.4475"
237
+ y2="25.9393"
238
+ stroke="currentColor"
239
+ stroke-width="3" />
240
+ </svg>
241
+ </button>
242
+
243
+ <div id="super-search-menu" class="gem-c-layout-super-navigation-header__search-items">
244
+ <h3 class="govuk-visually-hidden">
245
+ <%= navigation_search_subheading %>
246
+ </h3>
247
+ <div class="gem-c-layout-super-navigation-header__search-item">
248
+ <a class="gem-c-layout-super-navigation-header__search-item-link" href="/search">
249
+ <span class="gem-c-layout-super-navigation-header__search-item-link-text">
250
+ <%= search_text %>
251
+ </span>
252
+ <svg
253
+ class="gem-c-layout-super-navigation-header__search-item-link-icon"
254
+ width="27"
255
+ height="27"
256
+ viewBox="0 0 27 27"
257
+ fill="none"
258
+ xmlns="http://www.w3.org/2000/svg"
259
+ aria-hidden="true"
260
+ focusable="false"
261
+ >
262
+ <circle
263
+ cx="10.0161"
264
+ cy="10.0161"
265
+ r="8.51613"
266
+ stroke="currentColor"
267
+ stroke-width="3" />
268
+ <line
269
+ x1="15.8668"
270
+ y1="16.3587"
271
+ x2="25.4475"
272
+ y2="25.9393"
273
+ stroke="currentColor"
274
+ stroke-width="3" />
96
275
  </svg>
97
276
  </a>
98
- <div class="gem-c-layout-super-navigation-header__dropdown-menu">
99
- <form id="search" action="/search" method="get" role="search" aria-label="Site-wide">
100
- <%= render "govuk_publishing_components/components/search", {
101
- inline_label: false,
102
- label_text: raw("<h2 class=\"govuk-heading-m\">#{search_text}</h2>"),
103
- size: "large",
104
- } %>
105
- </form>
106
- <h2 class="govuk-heading-m"><%= popular_links_heading %></h2>
107
- <ul class="govuk-list">
108
- <% popular_links.each do | popular_link | %>
109
- <li class="gem-c-layout-super-navigation-header__dropdown-list-item">
110
- <a class="govuk-link gem-c-layout-super-navigation-header__dropdown-list-item-link" href="<%= popular_link[:href] %>">
111
- <%= popular_link[:label] %>
112
- </a>
113
- </li>
114
- <% end %>
115
- </ul>
277
+ </div>
278
+
279
+ <div class="govuk-width-container gem-c-layout-super-navigation-header__search-and-popular">
280
+ <div class="govuk-grid-row">
281
+ <div class="govuk-grid-column-full">
282
+ <form
283
+ class="gem-c-layout-super-navigation-header__search-form"
284
+ id="search"
285
+ action="/search"
286
+ method="get"
287
+ role="search"
288
+ aria-label="Site-wide"
289
+ >
290
+ <%= render "govuk_publishing_components/components/search", {
291
+ inline_label: false,
292
+ label_size: "m",
293
+ label_text: search_text,
294
+ size: "large",
295
+ data_attributes: {
296
+ track_category: "headerClicked",
297
+ track_action: "searchSubmitted",
298
+ track_label: "/search/all",
299
+ track_dimension: t("components.search_box.label"),
300
+ track_dimension_index: 29,
301
+ },
302
+ } %>
303
+ </form>
304
+ </div>
116
305
  </div>
117
- </li>
118
- </ul>
306
+ <div class="govuk-grid-row">
307
+ <div class="govuk-grid-column-full">
308
+ <h3 class="govuk-heading-m"><%= popular_links_heading %></h3>
309
+ <ul class="govuk-list">
310
+ <% popular_links.each do | popular_link | %>
311
+ <li class="gem-c-layout-super-navigation-header__popular-item">
312
+ <a class="govuk-link gem-c-layout-super-navigation-header__popular-link"
313
+ href="<%= popular_link[:href] %>"
314
+ data-module="gem-track-click"
315
+ data-track-action="popularLink"
316
+ data-track-category="headerClicked"
317
+ data-track-label="<%= popular_link[:href] %>"
318
+ data-track-dimension="<%= popular_link[:label] %>"
319
+ data-track-dimension-index="29">
320
+ <%= popular_link[:label] %>
321
+ </a>
322
+ </li>
323
+ <% end %>
324
+ </ul>
325
+ </div>
326
+ </div>
327
+ </div>
328
+ </div>
119
329
  </nav>
120
330
  </div>
121
331
  </header>
@@ -82,11 +82,13 @@ ar:
82
82
  layout_super_navigation_header:
83
83
  logo_link_title:
84
84
  logo_text:
85
+ navigation_links:
85
86
  navigation_menu_heading:
86
- search_text:
87
- popular_links_heading:
87
+ navigation_search_heading:
88
+ navigation_search_subheading:
88
89
  popular_links:
89
- navigation_links:
90
+ popular_links_heading:
91
+ search_text:
90
92
  metadata:
91
93
  from:
92
94
  history:
@@ -82,11 +82,13 @@ az:
82
82
  layout_super_navigation_header:
83
83
  logo_link_title:
84
84
  logo_text:
85
+ navigation_links:
85
86
  navigation_menu_heading:
86
- search_text:
87
- popular_links_heading:
87
+ navigation_search_heading:
88
+ navigation_search_subheading:
88
89
  popular_links:
89
- navigation_links:
90
+ popular_links_heading:
91
+ search_text:
90
92
  metadata:
91
93
  from:
92
94
  history:
@@ -82,11 +82,13 @@ be:
82
82
  layout_super_navigation_header:
83
83
  logo_link_title:
84
84
  logo_text:
85
+ navigation_links:
85
86
  navigation_menu_heading:
86
- search_text:
87
- popular_links_heading:
87
+ navigation_search_heading:
88
+ navigation_search_subheading:
88
89
  popular_links:
89
- navigation_links:
90
+ popular_links_heading:
91
+ search_text:
90
92
  metadata:
91
93
  from:
92
94
  history:
@@ -82,11 +82,13 @@ bg:
82
82
  layout_super_navigation_header:
83
83
  logo_link_title:
84
84
  logo_text:
85
+ navigation_links:
85
86
  navigation_menu_heading:
86
- search_text:
87
- popular_links_heading:
87
+ navigation_search_heading:
88
+ navigation_search_subheading:
88
89
  popular_links:
89
- navigation_links:
90
+ popular_links_heading:
91
+ search_text:
90
92
  metadata:
91
93
  from:
92
94
  history: