govuk_publishing_components 35.17.0 → 35.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (21) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +147 -11
  3. data/app/models/govuk_publishing_components/audit_applications.rb +4 -4
  4. data/app/models/govuk_publishing_components/audit_comparer.rb +5 -5
  5. data/app/views/govuk_publishing_components/components/_contents_list.html.erb +2 -1
  6. data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +11 -4
  7. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +154 -76
  8. data/app/views/govuk_publishing_components/components/docs/contents_list.yml +3 -4
  9. data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +5 -0
  10. data/app/views/govuk_publishing_components/components/docs/layout_super_navigation_header.yml +29 -0
  11. data/app/views/govuk_publishing_components/components/layout_for_public/_layout_super_navigation_header_homepage.html.erb +11 -0
  12. data/lib/govuk_publishing_components/presenters/attachment_helper.rb +1 -1
  13. data/lib/govuk_publishing_components/presenters/checkboxes_helper.rb +1 -1
  14. data/lib/govuk_publishing_components/presenters/content_item.rb +1 -1
  15. data/lib/govuk_publishing_components/presenters/contents_list_helper.rb +6 -0
  16. data/lib/govuk_publishing_components/presenters/curated_taxonomy_sidebar_links.rb +0 -2
  17. data/lib/govuk_publishing_components/presenters/devolved_nations_helper.rb +2 -2
  18. data/lib/govuk_publishing_components/presenters/page_with_step_by_step_navigation.rb +1 -1
  19. data/lib/govuk_publishing_components/presenters/public_layout_helper.rb +1 -1
  20. data/lib/govuk_publishing_components/version.rb +1 -1
  21. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b2ae98a5a0bfe9237ad8666586cf56d55c5f737e03cac016826b577ad6b280e0
4
- data.tar.gz: 66a94a3ef052fff63ba972df2ad0b39bf48220a42308c1d5bb06ba5343dbf621
3
+ metadata.gz: 5ce473a1a45f47ae5cf925f4de375968f8ad75223ef70a38d442be0160a66172
4
+ data.tar.gz: 71574933e54084b2ecff4bce0fe09eda6e34003f55fcb7d470300580e35eb54f
5
5
  SHA512:
6
- metadata.gz: 0e20d31b9ece60b5bda9387d1b87396dd4089fe10c6c808db6b11201988f7d07e2f23befc0d77a37f7842eda137edf9a200e963766b6971bcea707bfa9300e22
7
- data.tar.gz: a4e27aeecf3c73c9a105fbe4e307aedc6acd1e489349c917b8341b51f42b5b7bd2d6cab2e6b6ae3f864fdf5da69fa4db68ed1023db15cf73c0910521ff3e2f9a
6
+ metadata.gz: d663be268de23349809eeec83badafb7c24298221b29168df805b332bd757f4fa70d4addc4cbb197f07af00e1ed5bd501060a5c00f918a6f77ddacd7273149f0
7
+ data.tar.gz: 2b7437b0e9e25cd57b04ffe2e014ce182649fabeb5eaf10d73110f782eb255c7420bd7814273f361e4373687aff2a82fe1049ea3f7d688b05f4b9009dff46673
@@ -8,6 +8,10 @@ $search-width-or-height: $black-bar-height;
8
8
  $pseudo-underline-height: 3px;
9
9
  $button-pipe-colour: darken(govuk-colour("mid-grey"), 20%);
10
10
 
11
+ $large-navbar-height: 86px;
12
+
13
+ $pale-blue-colour: #d2e2f1;
14
+
11
15
  $after-link-padding: govuk-spacing(4);
12
16
  $after-button-padding-right: govuk-spacing(4);
13
17
  $after-button-padding-left: govuk-spacing(4);
@@ -89,6 +93,11 @@ $after-button-padding-left: govuk-spacing(4);
89
93
  }
90
94
  }
91
95
 
96
+ .gem-c-layout-super-navigation-header--blue-background {
97
+ background: $govuk-brand-colour;
98
+ border-top: 1px solid $govuk-brand-colour;
99
+ }
100
+
92
101
  .gem-c-layout-super-navigation-header__container {
93
102
  position: relative;
94
103
  }
@@ -128,7 +137,6 @@ $after-button-padding-left: govuk-spacing(4);
128
137
 
129
138
  .gem-c-layout-super-navigation-header__navigation-item,
130
139
  .gem-c-layout-super-navigation-header__search-item {
131
- background: govuk-colour("black");
132
140
  display: block;
133
141
  float: left;
134
142
  margin: 0;
@@ -205,6 +213,17 @@ $after-button-padding-left: govuk-spacing(4);
205
213
  }
206
214
  }
207
215
 
216
+ &.gem-c-layout-super-navigation-header__navigation-item-link--blue-background,
217
+ &.gem-c-layout-super-navigation-header__search-item-link--blue-background {
218
+ &:hover {
219
+ color: govuk-colour("white");
220
+
221
+ &::after {
222
+ background: govuk-colour("white");
223
+ }
224
+ }
225
+ }
226
+
208
227
  @include focus-and-focus-visible {
209
228
  .gem-c-layout-super-navigation-header__navigation-item-link-inner {
210
229
  border-color: $govuk-focus-colour;
@@ -267,6 +286,17 @@ $after-button-padding-left: govuk-spacing(4);
267
286
  }
268
287
  }
269
288
 
289
+ // to stop the black underline appearing underneath the menu
290
+ // after it has been toggled closed if the blue background has
291
+ // been enabled
292
+ .gem-c-layout-super-navigation-header__navigation-top-toggle-button.gem-c-layout-super-navigation-header__navigation-top-toggle-button--blue-background {
293
+ &:focus:not(:focus-visible) {
294
+ &::after {
295
+ background: none;
296
+ }
297
+ }
298
+ }
299
+
270
300
  .gem-c-layout-super-navigation-header__navigation-item-link {
271
301
  @include govuk-media-query($from: "desktop") {
272
302
  padding: govuk-spacing(3) 0;
@@ -279,11 +309,15 @@ $after-button-padding-left: govuk-spacing(4);
279
309
  }
280
310
 
281
311
  .gem-c-layout-super-navigation-header__navigation-item-link-inner {
282
- background-color: govuk-colour("black");
283
312
  border-left: 1px solid $button-pipe-colour;
284
313
  padding: govuk-spacing(1) $after-link-padding;
285
314
  }
286
315
 
316
+ .gem-c-layout-super-navigation-header__navigation-item-link-inner--blue-background {
317
+ border-left: 0;
318
+ border-right: 1px solid $pale-blue-colour;
319
+ }
320
+
287
321
  // Search link and dropdown.
288
322
  .gem-c-layout-super-navigation-header__search-item-link {
289
323
  padding: govuk-spacing(3);
@@ -297,8 +331,6 @@ $after-button-padding-left: govuk-spacing(4);
297
331
  background: $govuk-brand-colour;
298
332
 
299
333
  &:hover {
300
- background: govuk-colour("black");
301
-
302
334
  &::before {
303
335
  left: 0;
304
336
  right: 0;
@@ -321,10 +353,6 @@ $after-button-padding-left: govuk-spacing(4);
321
353
 
322
354
  @include focus-not-focus-visible {
323
355
  background: $govuk-link-colour;
324
-
325
- &:hover {
326
- background: govuk-colour("black");
327
- }
328
356
  }
329
357
 
330
358
  @include focus-and-focus-visible {
@@ -347,6 +375,10 @@ $after-button-padding-left: govuk-spacing(4);
347
375
  width: 21px;
348
376
  }
349
377
 
378
+ .gem-c-layout-super-navigation-header__open-button .gem-c-layout-super-navigation-header__search-toggle-button-link-icon {
379
+ display: none;
380
+ }
381
+
350
382
  // Search and popular content dropdown.
351
383
  .gem-c-layout-super-navigation-header__search-and-popular {
352
384
  display: none;
@@ -472,15 +504,23 @@ $after-button-padding-left: govuk-spacing(4);
472
504
  .gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner {
473
505
  border-color: $button-pipe-colour;
474
506
 
507
+ &.gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner--blue-background {
508
+ border-color: $pale-blue-colour;
509
+ }
510
+
475
511
  @include govuk-media-query($from: 360px) {
476
512
  &::before {
477
513
  @include chevron(govuk-colour("white"), true);
478
514
  }
479
515
  }
480
516
  }
517
+
481
518
  // stylelint-enable max-nesting-depth
482
519
  }
520
+ }
483
521
 
522
+ .gem-c-layout-super-navigation-header__navigation-top-toggle-button.gem-c-layout-super-navigation-header__navigation-top-toggle-button--blue-background,
523
+ .gem-c-layout-super-navigation-header__navigation-top-toggle-button {
484
524
  // Open button modifier
485
525
  &.gem-c-layout-super-navigation-header__open-button {
486
526
  // stylelint-disable max-nesting-depth
@@ -528,6 +568,24 @@ $after-button-padding-left: govuk-spacing(4);
528
568
  }
529
569
  }
530
570
 
571
+ .gem-c-layout-super-navigation-header__navigation-top-toggle-button--blue-background {
572
+ @include focus-not-focus-visible {
573
+ &:hover {
574
+ &::after {
575
+ background: govuk-colour("white");
576
+ }
577
+
578
+ .gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner {
579
+ color: govuk-colour("white");
580
+
581
+ &::before {
582
+ border-color: govuk-colour("white");
583
+ }
584
+ }
585
+ }
586
+ }
587
+ }
588
+
531
589
  .gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner {
532
590
  display: inline-block;
533
591
  border-left: 1px solid govuk-colour("white");
@@ -542,6 +600,10 @@ $after-button-padding-left: govuk-spacing(4);
542
600
  }
543
601
  }
544
602
 
603
+ .gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner--no-left-border {
604
+ border-left: 0;
605
+ }
606
+
545
607
  // Styles for search toggle button.
546
608
  .gem-c-layout-super-navigation-header__search-toggle-button {
547
609
  @include govuk-font($size: 19, $weight: "bold", $line-height: 20px);
@@ -580,11 +642,32 @@ $after-button-padding-left: govuk-spacing(4);
580
642
  }
581
643
 
582
644
  &:hover {
583
- background: govuk-colour("black");
584
645
  border-bottom: $pseudo-underline-height solid govuk-colour("mid-grey");
585
646
  color: govuk-colour("mid-grey");
586
647
  }
587
648
 
649
+ &.gem-c-layout-super-navigation-header__search-toggle-button--blue-background {
650
+ &:hover {
651
+ border-bottom: $pseudo-underline-height solid govuk-colour("white");
652
+ color: govuk-colour("white");
653
+ }
654
+
655
+ // stylelint-disable max-nesting-depth
656
+ @include focus-not-focus-visible {
657
+ border-bottom: none;
658
+ }
659
+ // stylelint-enable max-nesting-depth
660
+ }
661
+
662
+ &:focus-visible {
663
+ &.gem-c-layout-super-navigation-header__search-toggle-button--blue-background {
664
+ &:hover {
665
+ border-bottom: $pseudo-underline-height solid $govuk-focus-colour;
666
+ color: govuk-colour("black");
667
+ }
668
+ }
669
+ }
670
+
588
671
  @include focus-and-focus-visible {
589
672
  @include govuk-focused-text;
590
673
  border-bottom-color: $govuk-focus-colour;
@@ -594,6 +677,13 @@ $after-button-padding-left: govuk-spacing(4);
594
677
 
595
678
  // Open button modifier
596
679
  &.gem-c-layout-super-navigation-header__open-button {
680
+ &.gem-c-layout-super-navigation-header__search-toggle-button--blue-background {
681
+ &:hover {
682
+ border-bottom: $pseudo-underline-height solid govuk-colour("white");
683
+ color: govuk-colour("white");
684
+ }
685
+ }
686
+
597
687
  @include focus-and-focus-visible {
598
688
  @include govuk-focused-text;
599
689
  border-color: $govuk-focus-colour;
@@ -625,9 +715,7 @@ $after-button-padding-left: govuk-spacing(4);
625
715
  font-weight: normal;
626
716
  left: 0;
627
717
  line-height: 22px;
628
- padding: govuk-spacing(3) 0;
629
718
  pointer-events: none;
630
- position: absolute;
631
719
  right: 0;
632
720
  text-align: center;
633
721
  top: 0;
@@ -788,3 +876,51 @@ $after-button-padding-left: govuk-spacing(4);
788
876
  display: none;
789
877
  }
790
878
  }
879
+
880
+ @include govuk-media-query($from: desktop) {
881
+ // can't use govuk-spacing here because the navbar height
882
+ // isn't a multiple of 5 :(
883
+ .gem-c-layout-super-navigation-header__navigation-item-link--large-navbar,
884
+ .gem-c-layout-super-navigation-header__search-item-link--large-navbar {
885
+ padding-top: 33px;
886
+ padding-bottom: 33px;
887
+ }
888
+
889
+ .gem-c-layout-super-navigation-header__logotype-crown--large-navbar {
890
+ height: 36px;
891
+ width: 49px;
892
+ }
893
+
894
+ .gem-c-header__link--large-navbar:focus {
895
+ box-shadow: 0 -4px 0 18px $govuk-focus-colour;
896
+ border-bottom: $govuk-focus-width solid govuk-colour("black");
897
+ padding-bottom: 10px;
898
+ }
899
+
900
+ .gem-c-header__link--large-navbar:hover {
901
+ padding-bottom: 10px;
902
+ }
903
+
904
+ .gem-c-layout-super-navigation-header__header-logo--large-navbar {
905
+ height: 35px;
906
+ padding-bottom: govuk-spacing(5);
907
+ padding-top: govuk-spacing(5);
908
+ }
909
+
910
+ .gem-c-layout-super-navigation-header__search-toggle-button--large-navbar {
911
+ height: $large-navbar-height;
912
+ }
913
+
914
+ // to stop the search icon moving on hover
915
+ .gem-c-layout-super-navigation-header__search-toggle-button--large-navbar:hover {
916
+ padding-bottom: 12px;
917
+ }
918
+
919
+ .gem-c-layout-super-navigation-header__button-container--large-navbar {
920
+ top: -$large-navbar-height;
921
+ }
922
+
923
+ .gem-c-layout-super-navigation-header__navigation-top-toggle-button--large-navbar {
924
+ height: $large-navbar-height;
925
+ }
926
+ }
@@ -72,10 +72,10 @@ module GovukPublishingComponents
72
72
  end
73
73
 
74
74
  @data = {
75
- name: name,
76
- dir: dir,
77
- application_found: application_found,
78
- components_found: components_found,
75
+ name:,
76
+ dir:,
77
+ application_found:,
78
+ components_found:,
79
79
  gem_style_references: @gem_style_references.flatten.uniq.sort,
80
80
  jquery_references: @jquery_references.flatten.uniq.sort,
81
81
  component_locations: @component_locations,
@@ -95,8 +95,8 @@ module GovukPublishingComponents
95
95
  dir: result[:dir],
96
96
  application_found: result[:application_found],
97
97
  uses_static: application_uses_static,
98
- summary: summary,
99
- warnings: warnings,
98
+ summary:,
99
+ warnings:,
100
100
  warning_count: warnings.length,
101
101
  gem_style_references: result[:gem_style_references],
102
102
  jquery_references: result[:jquery_references],
@@ -126,8 +126,8 @@ module GovukPublishingComponents
126
126
 
127
127
  def create_warning(component, message)
128
128
  {
129
- component: component,
130
- message: message,
129
+ component:,
130
+ message:,
131
131
  }
132
132
  end
133
133
 
@@ -280,7 +280,7 @@ module GovukPublishingComponents
280
280
  results << {
281
281
  name: component_name,
282
282
  count: locations.length,
283
- locations: locations,
283
+ locations:,
284
284
  }
285
285
  end
286
286
 
@@ -15,7 +15,6 @@
15
15
  ga4_tracking ||= false
16
16
  ga4_data = {
17
17
  event_name: "navigation",
18
- type: "contents list",
19
18
  section: t("components.contents_list.contents", locale: :en) || "",
20
19
  index_total: cl_helper.get_index_total
21
20
  } if ga4_tracking
@@ -46,6 +45,7 @@
46
45
  ga4_data[:index] = {
47
46
  "index_link": index_link,
48
47
  }
48
+ ga4_data[:type] = cl_helper.get_ga4_type(contents_item[:href]) if contents_item[:href]
49
49
  end
50
50
  %>
51
51
  <%= link_to_if !contents_item[:active], link_text, contents_item[:href],
@@ -70,6 +70,7 @@
70
70
  ga4_data[:index] = {
71
71
  "index_link": index_link,
72
72
  }
73
+ ga4_data[:type] = cl_helper.get_ga4_type(nested_contents_item[:href]) if nested_contents_item[:href]
73
74
  end
74
75
  %>
75
76
  <%= link_to_if !nested_contents_item[:active], nested_contents_item[:text], nested_contents_item[:href],
@@ -6,6 +6,7 @@
6
6
  blue_bar ||= local_assigns.include?(:blue_bar) ? local_assigns[:blue_bar] : !full_width
7
7
  global_bar ||= nil
8
8
  html_lang ||= "en"
9
+ homepage ||= false
9
10
  layout_helper = GovukPublishingComponents::Presenters::PublicLayoutHelper.new(local_assigns)
10
11
  blue_bar_background_colour = layout_helper.blue_bar_background_colours.include?(blue_bar_background_colour) ? blue_bar_background_colour : nil
11
12
  logo_link ||= "/"
@@ -103,9 +104,15 @@
103
104
 
104
105
  <% unless omit_header %>
105
106
  <% if show_explore_header %>
106
- <%= render "govuk_publishing_components/components/layout_super_navigation_header", {
107
- logo_link: logo_link,
108
- } %>
107
+ <% if homepage %>
108
+ <%= render "govuk_publishing_components/components/layout_for_public/layout_super_navigation_header_homepage", {
109
+ logo_link: logo_link,
110
+ } %>
111
+ <% else %>
112
+ <%= render "govuk_publishing_components/components/layout_super_navigation_header", {
113
+ logo_link: logo_link,
114
+ } %>
115
+ <% end %>
109
116
  <% else %>
110
117
  <%= render "govuk_publishing_components/components/layout_header", {
111
118
  search: show_search,
@@ -122,7 +129,7 @@
122
129
 
123
130
  <%= raw(emergency_banner) %>
124
131
 
125
- <% if (blue_bar && !global_bar.present?) || (blue_bar_dedupe) %>
132
+ <% if (blue_bar && !global_bar.present? && !homepage) || (blue_bar_dedupe) %>
126
133
  <%= content_tag(:div, class: blue_bar_wrapper_classes) do %>
127
134
  <div class="gem-c-layout-for-public__blue-bar govuk-width-container"></div>
128
135
  <% end %>
@@ -5,6 +5,12 @@
5
5
  logo_link ||= "https://www.gov.uk/"
6
6
  logo_link_title ||= t("components.layout_super_navigation_header.logo_link_title")
7
7
  logo_text = t("components.layout_super_navigation_header.logo_text")
8
+
9
+ hide_logo_text ||= false
10
+ hide_button_left_border ||= false
11
+ blue_background ||= false
12
+ large_navbar ||= false
13
+
8
14
  navigation_links_columns = t("components.layout_super_navigation_header.navigation_links_columns")
9
15
  navigation_menu_heading = t("components.layout_super_navigation_header.navigation_menu_heading")
10
16
  navigation_search_heading = t("components.layout_super_navigation_header.navigation_search_heading")
@@ -17,63 +23,124 @@
17
23
  show_search_menu_text = t("components.layout_super_navigation_header.menu_toggle_label.show", :label => "search")
18
24
  hide_navigation_menu_text = t("components.layout_super_navigation_header.menu_toggle_label.hide", :label => "navigation")
19
25
  show_navigation_menu_text = t("components.layout_super_navigation_header.menu_toggle_label.show", :label => "navigation")
26
+
27
+ top_toggle_button_classes = %w(gem-c-layout-super-navigation-header__navigation-top-toggle-button
28
+ )
29
+ top_toggle_button_classes << "gem-c-layout-super-navigation-header__navigation-top-toggle-button--blue-background" if blue_background
30
+ top_toggle_button_classes << "gem-c-layout-super-navigation-header__navigation-top-toggle-button--large-navbar" if large_navbar
31
+
32
+ top_toggle_button_inner_classes = %w(gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner)
33
+ top_toggle_button_inner_classes << "gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner--no-left-border" if hide_button_left_border
34
+ top_toggle_button_inner_classes << "gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner--blue-background" if blue_background
35
+
36
+ search_toggle_button_classes = %w(gem-c-layout-super-navigation-header__search-toggle-button)
37
+ search_toggle_button_classes << "gem-c-layout-super-navigation-header__search-toggle-button--blue-background" if blue_background
38
+ search_toggle_button_classes << "gem-c-layout-super-navigation-header__search-toggle-button--large-navbar" if large_navbar
39
+
40
+ layout_super_navigation_header_classes = %w(gem-c-layout-super-navigation-header)
41
+ layout_super_navigation_header_classes << "gem-c-layout-super-navigation-header--blue-background" if blue_background
42
+
43
+ item_link_classes = %w(gem-c-layout-super-navigation-header__navigation-item-link)
44
+ item_link_classes << "gem-c-layout-super-navigation-header__navigation-item-link--blue-background" if blue_background
45
+ item_link_classes << "gem-c-layout-super-navigation-header__navigation-item-link--large-navbar" if large_navbar
46
+
47
+ item_link_inner_classes = %w(
48
+ gem-c-layout-super-navigation-header__navigation-item-link-inner
49
+ )
50
+ item_link_inner_classes << "gem-c-layout-super-navigation-header__navigation-item-link-inner--blue-background" if blue_background
51
+
52
+ search_item_link_classes = %w(gem-c-layout-super-navigation-header__search-item-link)
53
+ search_item_link_classes << "gem-c-layout-super-navigation-header__search-item-link--blue-background" if blue_background
54
+ search_item_link_classes << "gem-c-layout-super-navigation-header__search-item-link--large-navbar" if large_navbar
55
+
56
+ header_logo_classes = %w(gem-c-layout-super-navigation-header__header-logo)
57
+ header_logo_classes << "gem-c-layout-super-navigation-header__header-logo--large-navbar" if large_navbar
58
+
59
+ logotype_classes = %w(govuk-header__logotype-crown gem-c-layout-super-navigation-header__logotype-crown)
60
+ logotype_classes << "gem-c-layout-super-navigation-header__logotype-crown--large-navbar" if large_navbar
61
+
62
+ header_link_classes = %w(govuk-header__link govuk-header__link--homepage)
63
+ header_link_classes << "gem-c-header__link--large-navbar" if large_navbar
64
+
65
+ button_container_classes = %w(gem-c-layout-super-navigation-header__button-container)
66
+ button_container_classes << "gem-c-layout-super-navigation-header__button-container--large-navbar" if large_navbar
67
+
68
+
20
69
  %>
21
- <header role="banner" class="gem-c-layout-super-navigation-header" data-module="gem-track-click ga4-event-tracker ga4-link-tracker" data-track-links-only data-ga4-expandable>
70
+ <%= content_tag("header",
71
+ {
72
+ role: "banner",
73
+ class: layout_super_navigation_header_classes,
74
+ data: {
75
+ module: "gem-track-click ga4-event-tracker ga4-link-tracker",
76
+ "track-links-only": '',
77
+ "ga4-expandable": '',
78
+ }
79
+ }) do %>
22
80
  <div class="gem-c-layout-super-navigation-header__container govuk-clearfix">
23
81
  <div class="govuk-width-container">
24
- <div class="gem-c-layout-super-navigation-header__header-logo">
25
- <a
26
- class="govuk-header__link govuk-header__link--homepage"
27
- data-track-action="logoLink"
28
- data-track-category="headerClicked"
29
- data-track-label="<%= logo_link %>"
30
- data-track-dimension="<%= logo_text %>"
31
- data-track-dimension-index="29"
32
- href="<%= logo_link %>"
33
- id="logo"
34
- title="<%= logo_link_title %>"
35
- data-ga4-link="<%= {
36
- "event_name": "navigation",
37
- "type": "header menu bar",
38
- "external": "false",
39
- "text": "GOV.UK",
40
- "section": "Logo",
41
- "index": {
42
- "index_link": 1,
43
- "index_section": 0,
44
- "index_section_count": 2,
45
- },
46
- "index_total": 1
47
- }.to_json %>"
48
- >
82
+ <%= content_tag(:div, {
83
+ class: header_logo_classes
84
+ }) do %>
85
+ <%= link_to logo_link, {
86
+ class: header_link_classes,
87
+ data: {
88
+ "track-action": "logoLink",
89
+ "track-category": "headerClicked",
90
+ "track-label": logo_link,
91
+ "track-dimension": logo_text,
92
+ "track-dimension-index": "29",
93
+ "ga4-link": {
94
+ "event_name": "navigation",
95
+ "type": "header menu bar",
96
+ "external": "false",
97
+ "text": "GOV.UK",
98
+ "section": "Logo",
99
+ "index": {
100
+ "index_link": 1,
101
+ "index_section": 0,
102
+ "index_section_count": 2,
103
+ },
104
+ "index_total": 1
105
+ }.to_json
106
+ },
107
+ id: "logo",
108
+ aria: {
109
+ label: logo_link_title,
110
+ }
111
+ } do %>
49
112
  <span class="govuk-header__logotype">
50
113
  <!--[if gt IE 8]><!-->
51
- <svg
52
- aria-hidden="true"
53
- class="govuk-header__logotype-crown gem-c-layout-super-navigation-header__logotype-crown"
54
- focusable="false"
55
- height="30"
56
- viewBox="0 0 132 97"
57
- width="36"
58
- xmlns="http://www.w3.org/2000/svg"
59
- >
114
+ <%= content_tag(:svg, {
115
+ aria: {
116
+ hidden: true,
117
+ },
118
+ class: logotype_classes,
119
+ height: "30",
120
+ width: "36",
121
+ focusable: "false",
122
+ viewBox: "0 0 132 97",
123
+ xmlns: "http://www.w3.org/2000/svg",
124
+ }) do %>
60
125
  <path
61
126
  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"
62
127
  fill="currentColor"
63
128
  fill-rule="evenodd"
64
129
  >
65
130
  </path>
66
- </svg>
131
+ <% end %>
67
132
  <!--<![endif]-->
68
133
  <!--[if IE 8]>
69
134
  <img src="<%= asset_path('govuk-logotype-crown.png') %>" alt="" class="govuk-header__logotype-crown-fallback-image" width="36" height="32">
70
135
  <![endif]-->
71
- <span class="govuk-header__logotype-text">
72
- <%= logo_text %>
73
- </span>
136
+ <% unless hide_logo_text %>
137
+ <span class="govuk-header__logotype-text">
138
+ <%= logo_text %>
139
+ </span>
140
+ <% end %>
74
141
  </span>
75
- </a>
76
- </div>
142
+ <% end %>
143
+ <% end %>
77
144
  </div>
78
145
  <nav
79
146
  aria-labelledby="super-navigation-menu-heading"
@@ -93,10 +160,12 @@
93
160
  %>
94
161
 
95
162
  <div class="govuk-width-container gem-c-layout-super-navigation-header__button-width-container">
96
- <div class="gem-c-layout-super-navigation-header__button-container">
163
+ <%= content_tag(:div, {
164
+ class: button_container_classes
165
+ }) do %>
97
166
  <div class="gem-c-layout-super-navigation-header__navigation-item">
98
167
  <%= link_to link[:href], {
99
- class: "gem-c-layout-super-navigation-header__navigation-item-link",
168
+ class: item_link_classes,
100
169
  data: {
101
170
  track_action: "#{tracking_label}Link",
102
171
  track_category: "headerClicked",
@@ -105,9 +174,11 @@
105
174
  track_dimension_index: "29",
106
175
  }
107
176
  } do %>
108
- <span class="gem-c-layout-super-navigation-header__navigation-item-link-inner">
177
+ <% content_tag(:span, {
178
+ class: item_link_inner_classes
179
+ }) do %>
109
180
  <%= link[:label] %>
110
- </span>
181
+ <% end %>
111
182
  <% end %>
112
183
 
113
184
  <%= content_tag(:button, {
@@ -116,7 +187,7 @@
116
187
  expanded: false,
117
188
  label: show_menu_text,
118
189
  },
119
- class: "gem-c-layout-super-navigation-header__navigation-top-toggle-button",
190
+ class: top_toggle_button_classes,
120
191
  data: {
121
192
  text_for_hide: hide_menu_text,
122
193
  text_for_show: show_menu_text,
@@ -138,35 +209,40 @@
138
209
  id: "super-navigation-menu-#{unique_id}-toggle",
139
210
  type: "button",
140
211
  }) do %>
141
- <%= tag.span link[:label], class: "gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner" %>
212
+ <%= tag.span link[:label], class: top_toggle_button_inner_classes %>
142
213
  <% end %>
143
214
  </div>
144
215
 
145
216
  <div class="gem-c-layout-super-navigation-header__search-item">
146
- <button
147
- aria-controls="super-search-menu"
148
- aria-expanded="true"
149
- aria-label="<%= hide_search_menu_text %>"
150
- class="gem-c-layout-super-navigation-header__search-toggle-button"
151
- data-text-for-hide="<%= hide_search_menu_text %>"
152
- data-text-for-show="<%= show_search_menu_text %>"
153
- data-toggle-mobile-group="top"
154
- data-toggle-desktop-group="top"
155
- data-tracking-key="search"
156
- hidden
157
- id="super-search-menu-toggle"
158
- type="button"
159
- data-ga4-event="<%= {
160
- "event_name": "select_content",
161
- "type": "header menu bar",
162
- "text": "Search",
163
- "index": {
164
- "index_section": 2,
165
- "index_section_count": 2,
166
- },
167
- "section": "Search"
168
- }.to_json %>"
169
- >
217
+ <%= content_tag(:button, {
218
+ id: "super-search-menu-toggle",
219
+ class: search_toggle_button_classes,
220
+ aria: {
221
+ controls: "super-search-menu",
222
+ expanded: "true",
223
+ label: hide_search_menu_text,
224
+ },
225
+ data: {
226
+ "text-for-hide": hide_search_menu_text,
227
+ "text-for-show": show_search_menu_text,
228
+ "toggle-mobile-group": "top",
229
+ "toggle-desktop-group": "top",
230
+ "tracking-key": "search",
231
+ "ga4-event": "#{{
232
+ "event_name": "select_content",
233
+ "type": "header menu bar",
234
+ "text": "Search",
235
+ "index": {
236
+ "index_section": 2,
237
+ "index_section_count": 2,
238
+ },
239
+ "section": "Search"
240
+ }.to_json
241
+ }"
242
+ },
243
+ hidden: true,
244
+ type: "button",
245
+ }) do %>
170
246
  <span class="govuk-visually-hidden">
171
247
  <%= search_text %>
172
248
  </span>
@@ -182,9 +258,11 @@
182
258
  >
183
259
  &times;
184
260
  </span>
185
- </button>
261
+ <% end %>
186
262
 
187
- <a class="gem-c-layout-super-navigation-header__search-item-link" href="/search">
263
+ <%= link_to "/search", {
264
+ class: search_item_link_classes
265
+ } do %>
188
266
  <span class="govuk-visually-hidden">
189
267
  <%= search_text %>
190
268
  </span>
@@ -193,9 +271,9 @@
193
271
  classes: %w[gem-c-layout-super-navigation-header__search-item-link-icon],
194
272
  }
195
273
  %>
196
- </a>
274
+ <% end %>
197
275
  </div>
198
- </div>
276
+ <% end %>
199
277
  </div>
200
278
 
201
279
  <div
@@ -336,4 +414,4 @@
336
414
  </div>
337
415
  </nav>
338
416
  </div>
339
- </header>
417
+ <% end %>
@@ -197,18 +197,17 @@ examples:
197
197
  data:
198
198
  ga4_tracking: true
199
199
  contents:
200
- - href: "#first-thing"
200
+ - href: "https://www.gov.uk"
201
201
  text: 1. First thing
202
202
  items:
203
203
  - href: "#second-thing"
204
204
  text: 1. Nested Item
205
- - href: "#third-thing"
206
- text: 2. Nested Item
205
+ - text: 2. Nested Item
207
206
  active: true
208
207
  - href: "#first-thing"
209
208
  text: 2. Second thing
210
209
  items:
211
210
  - href: "#second-thing"
212
211
  text: 1. Nested Item
213
- - href: "#third-thing"
212
+ - href: "https://www.gov.uk/browse"
214
213
  text: 2. Nested Item
@@ -37,6 +37,11 @@ examples:
37
37
  description: This allows the feedback form to be omitted
38
38
  data:
39
39
  omit_feedback_form: true
40
+ homepage:
41
+ description: This allows for rendering the layout super navigation header in a different way for only the homepage.
42
+ data:
43
+ homepage: true
44
+ show_explore_header: true
40
45
  omit_footer_navigation:
41
46
  description: This allows the footer navigation to be omitted
42
47
  data:
@@ -34,3 +34,32 @@ examples:
34
34
  data:
35
35
  logo_link: "https://www.example.com"
36
36
  logo_link_title: "Go to example"
37
+ homepage:
38
+ description: |
39
+ This variant is used for the homepage. It toggles the following attributes: hide_button_left_border, hide_logo_text and blue_background
40
+ data:
41
+ hide_logo_text: true
42
+ hide_button_left_border: true
43
+ blue_background: true
44
+ large_navbar: true
45
+ hide_logo_text:
46
+ description: |
47
+ Logo text is shown by default. This option allows us to hide the text for the homepage.
48
+ data:
49
+ hide_logo_text: true
50
+ remove_left_button_border:
51
+ description: |
52
+ The left border for the toggle button is shown by default. This option allows us to hide the text for the homepage.
53
+ data:
54
+ hide_button_left_border: true
55
+ blue_blackground_colour:
56
+ description: |
57
+ The black background is shown by default. This option allows us to change the background colour for the homepage.
58
+ data:
59
+ blue_background: true
60
+ large_navbar:
61
+ description: |
62
+ Make the links and buttons large on desktop only. Used for the homepage.
63
+ data:
64
+ large_navbar: true
65
+ hide_logo_text: true
@@ -0,0 +1,11 @@
1
+ <% logo_link ||= "/" %>
2
+
3
+ <%= render "govuk_publishing_components/components/layout_super_navigation_header",
4
+ {
5
+ hide_logo_text: true,
6
+ logo_link: logo_link,
7
+ blue_background: true,
8
+ hide_button_left_border: true,
9
+ large_navbar: true,
10
+ }
11
+ %>
@@ -119,7 +119,7 @@ module GovukPublishingComponents
119
119
  def self.find(content_type, extension = nil)
120
120
  matching_types = TYPES.select { |type| type[:content_type] == content_type }
121
121
 
122
- return UnsupportedContentType.new(content_type: content_type) if matching_types.empty?
122
+ return UnsupportedContentType.new(content_type:) if matching_types.empty?
123
123
 
124
124
  extension_match = if matching_types.length > 1
125
125
  matching_types.find { |type| type[:extension] == extension }
@@ -98,7 +98,7 @@ module GovukPublishingComponents
98
98
  data[:behaviour] = "exclusive" if checkbox[:exclusive]
99
99
 
100
100
  capture do
101
- concat check_box_tag checkbox_name, checkbox[:value], checked, class: "govuk-checkboxes__input", id: checkbox_id, data: data
101
+ concat check_box_tag(checkbox_name, checkbox[:value], checked, class: "govuk-checkboxes__input", id: checkbox_id, data:)
102
102
  concat content_tag(:label, checkbox[:label], for: checkbox_id, class: "govuk-label govuk-checkboxes__label")
103
103
  concat content_tag(:span, checkbox[:hint], id: "#{checkbox_id}-item-hint", class: "govuk-hint govuk-checkboxes__hint") if checkbox[:hint]
104
104
  end
@@ -119,7 +119,7 @@ module GovukPublishingComponents
119
119
 
120
120
  def as_taxonomy_sidebar_link
121
121
  {
122
- title: title,
122
+ title:,
123
123
  link: base_path,
124
124
  }
125
125
  end
@@ -48,6 +48,12 @@ module GovukPublishingComponents
48
48
  total
49
49
  end
50
50
 
51
+ def get_ga4_type(link)
52
+ return "select content" if link.start_with?("#")
53
+
54
+ "contents list"
55
+ end
56
+
51
57
  private
52
58
 
53
59
  def parent_modifier
@@ -1,5 +1,3 @@
1
- require "set"
2
-
3
1
  module GovukPublishingComponents
4
2
  module Presenters
5
3
  # @private
@@ -43,9 +43,9 @@ module GovukPublishingComponents
43
43
  nation = I18n.t("components.devolved_nations.#{name}")
44
44
 
45
45
  if I18n.exists?("components.devolved_nations.type.#{@type}")
46
- I18n.t("components.devolved_nations.type.#{@type}", nation: nation)
46
+ I18n.t("components.devolved_nations.type.#{@type}", nation:)
47
47
  else
48
- I18n.t("components.devolved_nations.type.publication", nation: nation)
48
+ I18n.t("components.devolved_nations.type.publication", nation:)
49
49
  end
50
50
  end
51
51
  end
@@ -88,7 +88,7 @@ module GovukPublishingComponents
88
88
  title: current_step_nav.title,
89
89
  path: current_step_nav.base_path,
90
90
  tracking_id: current_step_nav.content_id,
91
- ga4_tracking: ga4_tracking,
91
+ ga4_tracking:,
92
92
  }
93
93
  else
94
94
  {}
@@ -77,7 +77,7 @@ module GovukPublishingComponents
77
77
  def generate_data_attribute(link, track_action)
78
78
  {
79
79
  track_category: "footerClicked",
80
- track_action: track_action,
80
+ track_action:,
81
81
  track_label: link[:href],
82
82
  track_options: {
83
83
  dimension29: link[:text],
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "35.17.0".freeze
2
+ VERSION = "35.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: 35.17.0
4
+ version: 35.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: 2023-09-29 00:00:00.000000000 Z
11
+ date: 2023-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -838,6 +838,7 @@ files:
838
838
  - app/views/govuk_publishing_components/components/feedback/_yes_no_banner.html.erb
839
839
  - app/views/govuk_publishing_components/components/layout_for_public/_account-layout.html.erb
840
840
  - app/views/govuk_publishing_components/components/layout_for_public/_account-navigation.html.erb
841
+ - app/views/govuk_publishing_components/components/layout_for_public/_layout_super_navigation_header_homepage.html.erb
841
842
  - app/views/govuk_publishing_components/components/layout_header/_header_logo.html.erb
842
843
  - app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb
843
844
  - app/views/govuk_publishing_components/components/layout_header/_search.html.erb
@@ -1468,7 +1469,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
1468
1469
  requirements:
1469
1470
  - - ">="
1470
1471
  - !ruby/object:Gem::Version
1471
- version: '3.0'
1472
+ version: '3.1'
1472
1473
  required_rubygems_version: !ruby/object:Gem::Requirement
1473
1474
  requirements:
1474
1475
  - - ">="