govuk-components 2.1.2 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a251ce9b412d46a7fd70155a08ba3cc2f6e9830baca832622bdeb459936b791f
4
- data.tar.gz: 85cccf721573ce9c734d7156de9da9c1ceefc22cac05888d8163d9441420be7b
3
+ metadata.gz: 1ff2f2871745bc313242de390b143fd475f0983e6ddf03c627512d26e5c52b8c
4
+ data.tar.gz: c191fa0f05fea8fa6bc19d9fddf8528802086a05f63217e4b48079329cf25a87
5
5
  SHA512:
6
- metadata.gz: c94357e58eee8a5ee0ae6e059f3177e340340d7af7cd19cfc3de607cc3b04e52d62e689a9291cc94ae568a1e1de809e224c566cb82a9b148986346773b45064b
7
- data.tar.gz: 89494b6d782f7aaf2e4453fc317c917bb87e6dafabd21cd8b6d0d363ebba546ae2ffbdef43f129d8eaff875f0a3cd1b804a99f271f5a33779fca3ec8fddf2d0b
6
+ metadata.gz: ea255c815feebd10555c8f403b4cd3ebac0d807cd1f4fe9a34442318a2f95d75cbbe309fb0f18aebbfcc0a7c32ee3bc962c971717fe7f9506ab10844eea8cda0
7
+ data.tar.gz: 6dada7350b560d7b967fa1bba83231d82173b1f81c90c563d803583fc4d99347a9973e193adda2eb58af86a86183d5e22d3b17d5e7be3aa9fb0ec8066af75c04
@@ -51,7 +51,7 @@ private
51
51
  def wrap_in_p(message_text)
52
52
  return if message_text.blank?
53
53
 
54
- tag.p(message_text)
54
+ tag.p(message_text, class: "govuk-body")
55
55
  end
56
56
 
57
57
  def actions_element
@@ -7,11 +7,19 @@
7
7
  <%= custom_logo %>
8
8
  <% else %>
9
9
  <% if crown %>
10
+ <!--[if gt IE 8]><!-->
10
11
  <svg aria-hidden="true" focusable="false" class="govuk-header__logotype-crown" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 132 97" height="30" width="36">
11
12
  <path fill="currentColor" fill-rule="evenodd" d="M25 30.2c3.5 1.5 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-.2.7-.6 1-.9zM66 92.8c16.9 0 32.8 1.1 47.1 3.2 4-16.9 8.9-26.7 14-33.5l-9.6-3.4c1 4.9 1.1 7.2 0 10.2-1.5-1.4-3-4.3-4.2-8.7L108.6 76c2.8-2 5-3.2 7.5-3.3-4.4 9.4-10 11.9-13.6 11.2-4.3-.8-6.3-4.6-5.6-7.9 1-4.7 5.7-5.9 8-.5 4.3-8.7-3-11.4-7.6-8.8 7.1-7.2 7.9-13.5 2.1-21.1-8 6.1-8.1 12.3-4.5 20.8-4.7-5.4-12.1-2.5-9.5 6.2 3.4-5.2 7.9-2 7.2 3.1-.6 4.3-6.4 7.8-13.5 7.2-10.3-.9-10.9-8-11.2-13.8 2.5-.5 7.1 1.8 11 7.3L80.2 60c-4.1 4.4-8 5.3-12.3 5.4 1.4-4.4 8-11.6 8-11.6H55.5s6.4 7.2 7.9 11.6c-4.2-.1-8-1-12.3-5.4l1.4 16.4c3.9-5.5 8.5-7.7 10.9-7.3-.3 5.8-.9 12.8-11.1 13.8-7.2.6-12.9-2.9-13.5-7.2-.7-5 3.8-8.3 7.1-3.1 2.7-8.7-4.6-11.6-9.4-6.2 3.7-8.5 3.6-14.7-4.6-20.8-5.8 7.6-5 13.9 2.2 21.1-4.7-2.6-11.9.1-7.7 8.8 2.3-5.5 7.1-4.2 8.1.5.7 3.3-1.3 7.1-5.7 7.9-3.5.7-9-1.8-13.5-11.2 2.5.1 4.7 1.3 7.5 3.3l-4.7-15.4c-1.2 4.4-2.7 7.2-4.3 8.7-1.1-3-.9-5.3 0-10.2l-9.5 3.4c5 6.9 9.9 16.7 14 33.5 14.8-2.1 30.8-3.2 47.7-3.2z"></path>
12
- <image src="/assets/images/govuk-logotype-crown.png" xlink:href="" class="govuk-header__logotype-crown-fallback-image" width="36" height="32"></image>
13
13
  </svg>
14
+ <!--<![endif]-->
14
15
  <% end %>
16
+
17
+ <% if crown_fallback_image_path.present? %>
18
+ <!--[if IE 8]>
19
+ <%= image_tag(crown_fallback_image_path, **crown_fallback_image_attributes) %>
20
+ <![endif]-->
21
+ <% end %>
22
+
15
23
  <%= tag.span(logotype, class: "govuk-header__logotype-text") %>
16
24
  <% end %>
17
25
  </span>
@@ -32,9 +40,7 @@
32
40
  <nav>
33
41
  <%= tag.ul(class: navigation_classes, id: "navigation", aria: { label: navigation_label }) do %>
34
42
  <% navigation_items.each do |item| %>
35
- <%= tag.li(class: item.classes.append(item.active_class), **item.html_attributes) do %>
36
- <%= item %>
37
- <% end %>
43
+ <%= item %>
38
44
  <% end %>
39
45
  <% end %>
40
46
  </nav>
@@ -5,6 +5,7 @@ class GovukComponent::HeaderComponent < GovukComponent::Base
5
5
 
6
6
  attr_reader :logotype,
7
7
  :crown,
8
+ :crown_fallback_image_path,
8
9
  :homepage_url,
9
10
  :service_name,
10
11
  :service_url,
@@ -17,6 +18,7 @@ class GovukComponent::HeaderComponent < GovukComponent::Base
17
18
  html_attributes: {},
18
19
  logotype: 'GOV.UK',
19
20
  crown: true,
21
+ crown_fallback_image_path: nil,
20
22
  homepage_url: '/',
21
23
  menu_button_label: 'Show or hide navigation menu',
22
24
  navigation_classes: [],
@@ -29,6 +31,7 @@ class GovukComponent::HeaderComponent < GovukComponent::Base
29
31
 
30
32
  @logotype = logotype
31
33
  @crown = crown
34
+ @crown_fallback_image_path = crown_fallback_image_path
32
35
  @homepage_url = homepage_url
33
36
  @service_name = service_name
34
37
  @service_url = service_url
@@ -52,6 +55,14 @@ private
52
55
  combine_classes(%w(govuk-header__container govuk-width-container), custom_container_classes)
53
56
  end
54
57
 
58
+ def crown_fallback_image_attributes
59
+ {
60
+ class: "govuk-header__logotype-crown-fallback-image",
61
+ width: "36",
62
+ height: "32",
63
+ }
64
+ end
65
+
55
66
  class NavigationItem < GovukComponent::Base
56
67
  attr_reader :text, :href, :options, :active
57
68
 
@@ -61,17 +72,16 @@ private
61
72
  @text = text
62
73
  @href = href
63
74
  @options = options
64
- @active = active
65
- end
66
75
 
67
- def active?
68
- return current_page?(href) if active.nil?
76
+ @active_override = active
77
+ end
69
78
 
70
- active
79
+ def before_render
80
+ @active = active?(@active_override)
71
81
  end
72
82
 
73
83
  def active_class
74
- %w(govuk-header__navigation-item--active) if active?
84
+ %w(govuk-header__navigation-item--active) if @active
75
85
  end
76
86
 
77
87
  def link?
@@ -79,15 +89,23 @@ private
79
89
  end
80
90
 
81
91
  def call
82
- if link?
83
- link_to(text, href, **options, class: "govuk-header__link")
84
- else
85
- text
92
+ tag.li(class: classes.append(active_class), **html_attributes) do
93
+ if link?
94
+ link_to(text, href, **options, class: "govuk-header__link")
95
+ else
96
+ text
97
+ end
86
98
  end
87
99
  end
88
100
 
89
101
  private
90
102
 
103
+ def active?(active_override)
104
+ return current_page?(href) if active_override.nil?
105
+
106
+ active_override
107
+ end
108
+
91
109
  def default_classes
92
110
  %w(govuk-header__navigation-item)
93
111
  end
@@ -1,5 +1,5 @@
1
1
  module Govuk
2
2
  module Components
3
- VERSION = '2.1.2'.freeze
3
+ VERSION = '2.1.3'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk-components
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - DfE developers
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-29 00:00:00.000000000 Z
11
+ date: 2021-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -220,7 +220,7 @@ homepage: https://github.com/DFE-Digital/govuk-components
220
220
  licenses:
221
221
  - MIT
222
222
  metadata: {}
223
- post_install_message:
223
+ post_install_message:
224
224
  rdoc_options: []
225
225
  require_paths:
226
226
  - lib
@@ -235,8 +235,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
235
235
  - !ruby/object:Gem::Version
236
236
  version: '0'
237
237
  requirements: []
238
- rubygems_version: 3.1.6
239
- signing_key:
238
+ rubygems_version: 3.2.22
239
+ signing_key:
240
240
  specification_version: 4
241
241
  summary: Lightweight set of reusable GOV.UK Design System components
242
242
  test_files: []