govuk_publishing_components 25.1.0 → 25.2.0

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 +580 -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 +244 -63
  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,246 @@ 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] %>">
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
+ <a class="gem-c-layout-super-navigation-header__navigation-item-link" href="<%= link[:href] %>">
59
94
  <%= link[:label] %>
60
95
  </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>
96
+ <% if has_children %>
97
+ <button
98
+ aria-controls="super-navigation-menu__section-<%= unique_id %>"
99
+ aria-expanded="false"
100
+ aria-label="<%= show_menu_text %>"
101
+ class="gem-c-layout-super-navigation-header__navigation-second-toggle-button"
102
+ data-text-for-hide="<%= hide_menu_text %>"
103
+ data-text-for-show="<%= show_menu_text %>"
104
+ data-toggle-desktop-group="top"
105
+ data-toggle-mobile-group="second"
106
+ data-tracking-key="<%= tracking_label %>"
107
+ hidden
108
+ id="super-navigation-menu__section-<%= unique_id %>-toggle"
109
+ type="button"
110
+ >
111
+ <%= link[:label] %>
112
+ </button>
113
+ <div
114
+ hidden
115
+ class="gem-c-layout-super-navigation-header__navigation-dropdown-menu"
116
+ id="super-navigation-menu__section-<%= unique_id %>"
117
+ >
118
+ <div class="govuk-width-container">
119
+ <div class="govuk-grid-row">
120
+ <div class="govuk-grid-column-one-third-from-desktop">
121
+ <% if link[:description].present? %>
122
+ <p class="govuk-body-l gem-c-layout-super-navigation-header__menu-description">
123
+ <%= link[:description] %>
124
+ </p>
125
+ <% end %>
126
+ </div>
127
+ <% if link[:menu_contents].present? %>
128
+ <div class="govuk-grid-column-two-thirds-from-desktop">
129
+ <ul class="govuk-list gem-c-layout-super-navigation-header__navigation-second-items">
130
+ <% link[:menu_contents].each do | item | %>
131
+ <%
132
+ has_description = item[:description].present?
133
+ link_classes = %w[govuk-link gem-c-layout-super-navigation-header__navigation-second-item-link]
134
+ link_classes << "gem-c-layout-super-navigation-header__navigation-second-item-link--with-description" if has_description
135
+ %>
136
+ <li class="gem-c-layout-super-navigation-header__dropdown-list-item">
137
+ <%= link_to item[:label], item[:href], { class: link_classes } %>
138
+ <%= tag.p item[:description], class: "govuk-body govuk-!-margin-0" if has_description %>
139
+ </li>
140
+ <% end %>
141
+ </ul>
142
+ </div>
72
143
  <% 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 %>
144
+ </div>
145
+ <% if link[:footer_links].present? %>
146
+ <div class="govuk-grid-row">
147
+ <div class="govuk-grid-column-full">
148
+ <div class="gem-c-layout-super-navigation-header__navigation-second-footer">
149
+ <div class="govuk-grid-row">
150
+ <ul class="gem-c-layout-super-navigation-header__navigation-second-footer-list">
151
+ <% link[:footer_links].each do | item | %>
152
+ <li class="gem-c-layout-super-navigation-header__navigation-second-footer-item">
153
+ <a class="govuk-link gem-c-layout-super-navigation-header__navigation-second-footer-link" href="<%= item[:href] %>">
154
+ <%= item[:label] %>
155
+ </a>
156
+ </li>
157
+ <% end %>
158
+ </ul>
159
+ </div>
160
+ </div>
161
+ </div>
162
+ </div>
163
+ <% end %>
164
+ </div>
86
165
  </div>
87
166
  <% end %>
88
- </li>
167
+ <% end %>
89
168
  <% 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" />
169
+ </ul>
170
+
171
+ <button
172
+ aria-controls="super-search-menu"
173
+ aria-expanded="true"
174
+ aria-label="<%= hide_search_menu_text %>"
175
+ class="gem-c-layout-super-navigation-header__search-toggle-button"
176
+ data-text-for-hide="<%= hide_search_menu_text %>"
177
+ data-text-for-show="<%= show_search_menu_text %>"
178
+ data-toggle-mobile-group="top"
179
+ data-toggle-desktop-group="top"
180
+ data-tracking-key="search"
181
+ hidden
182
+ id="super-search-menu-toggle"
183
+ type="button"
184
+ >
185
+ <span class="govuk-visually-hidden">
186
+ <%= search_text %>
187
+ </span>
188
+ <svg
189
+ class="gem-c-layout-super-navigation-header__search-toggle-button-link-icon"
190
+ width="27"
191
+ height="27"
192
+ viewBox="0 0 27 27"
193
+ fill="none"
194
+ xmlns="http://www.w3.org/2000/svg"
195
+ aria-hidden="true"
196
+ focusable="false"
197
+ >
198
+ <circle
199
+ cx="10.0161"
200
+ cy="10.0161"
201
+ r="8.51613"
202
+ stroke="currentColor"
203
+ stroke-width="3" />
204
+ <line
205
+ x1="15.8668"
206
+ y1="16.3587"
207
+ x2="25.4475"
208
+ y2="25.9393"
209
+ stroke="currentColor"
210
+ stroke-width="3" />
211
+ </svg>
212
+ </button>
213
+
214
+ <div id="super-search-menu" class="gem-c-layout-super-navigation-header__search-items">
215
+ <h3 class="govuk-visually-hidden">
216
+ <%= navigation_search_subheading %>
217
+ </h3>
218
+ <div class="gem-c-layout-super-navigation-header__search-item">
219
+ <a class="gem-c-layout-super-navigation-header__search-item-link" href="/search">
220
+ <span class="gem-c-layout-super-navigation-header__search-item-link-text">
221
+ <%= search_text %>
222
+ </span>
223
+ <svg
224
+ class="gem-c-layout-super-navigation-header__search-item-link-icon"
225
+ width="27"
226
+ height="27"
227
+ viewBox="0 0 27 27"
228
+ fill="none"
229
+ xmlns="http://www.w3.org/2000/svg"
230
+ aria-hidden="true"
231
+ focusable="false"
232
+ >
233
+ <circle
234
+ cx="10.0161"
235
+ cy="10.0161"
236
+ r="8.51613"
237
+ stroke="currentColor"
238
+ stroke-width="3" />
239
+ <line
240
+ x1="15.8668"
241
+ y1="16.3587"
242
+ x2="25.4475"
243
+ y2="25.9393"
244
+ stroke="currentColor"
245
+ stroke-width="3" />
96
246
  </svg>
97
247
  </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>
248
+ </div>
249
+
250
+ <div class="govuk-width-container gem-c-layout-super-navigation-header__search-and-popular">
251
+ <div class="govuk-grid-row">
252
+ <div class="govuk-grid-column-full">
253
+ <form
254
+ class="gem-c-layout-super-navigation-header__search-form"
255
+ id="search"
256
+ action="/search"
257
+ method="get"
258
+ role="search"
259
+ aria-label="Site-wide"
260
+ >
261
+ <%= render "govuk_publishing_components/components/search", {
262
+ inline_label: false,
263
+ label_size: "m",
264
+ label_text: search_text,
265
+ size: "large",
266
+ data_attributes: {
267
+ track_category: "headerClicked",
268
+ track_action: "searchSubmitted",
269
+ track_label: "/search/all",
270
+ track_dimension: t("components.search_box.label"),
271
+ track_dimension_index: 29,
272
+ },
273
+ } %>
274
+ </form>
275
+ </div>
116
276
  </div>
117
- </li>
118
- </ul>
277
+ <div class="govuk-grid-row">
278
+ <div class="govuk-grid-column-full">
279
+ <h3 class="govuk-heading-m"><%= popular_links_heading %></h3>
280
+ <ul class="govuk-list">
281
+ <% popular_links.each do | popular_link | %>
282
+ <li class="gem-c-layout-super-navigation-header__popular-item">
283
+ <a class="govuk-link gem-c-layout-super-navigation-header__popular-link"
284
+ href="<%= popular_link[:href] %>"
285
+ data-module="gem-track-click"
286
+ data-track-action="popularLink"
287
+ data-track-category="headerClicked"
288
+ data-track-label="<%= popular_link[:href] %>"
289
+ data-track-dimension="<%= popular_link[:label] %>"
290
+ data-track-dimension-index="29">
291
+ <%= popular_link[:label] %>
292
+ </a>
293
+ </li>
294
+ <% end %>
295
+ </ul>
296
+ </div>
297
+ </div>
298
+ </div>
299
+ </div>
119
300
  </nav>
120
301
  </div>
121
302
  </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:
@@ -82,11 +82,13 @@ bn:
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: