govuk-components 1.1.8 → 2.0.0b3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -1
  3. data/app/components/govuk_component/{accordion.html.erb → accordion_component.html.erb} +2 -2
  4. data/app/components/govuk_component/{accordion.rb → accordion_component.rb} +7 -6
  5. data/app/components/govuk_component/{back_link.rb → back_link_component.rb} +5 -1
  6. data/app/components/govuk_component/base.rb +9 -7
  7. data/app/components/govuk_component/{breadcrumbs.html.erb → breadcrumbs_component.html.erb} +3 -6
  8. data/app/components/govuk_component/{breadcrumbs.rb → breadcrumbs_component.rb} +1 -1
  9. data/app/components/govuk_component/{cookie_banner.html.erb → cookie_banner_component.html.erb} +2 -6
  10. data/app/components/govuk_component/{cookie_banner.rb → cookie_banner_component.rb} +3 -2
  11. data/app/components/govuk_component/details_component.rb +34 -0
  12. data/app/components/govuk_component/{footer.html.erb → footer_component.html.erb} +3 -5
  13. data/app/components/govuk_component/{footer.rb → footer_component.rb} +3 -8
  14. data/app/components/govuk_component/header_component.html.erb +49 -0
  15. data/app/components/govuk_component/header_component.rb +110 -0
  16. data/app/components/govuk_component/{inset_text.rb → inset_text_component.rb} +3 -3
  17. data/app/components/govuk_component/notification_banner_component.html.erb +14 -0
  18. data/app/components/govuk_component/{notification_banner.rb → notification_banner_component.rb} +28 -14
  19. data/app/components/govuk_component/panel_component.rb +46 -0
  20. data/app/components/govuk_component/phase_banner_component.html.erb +6 -0
  21. data/app/components/govuk_component/phase_banner_component.rb +20 -0
  22. data/app/components/govuk_component/start_button_component.rb +47 -0
  23. data/app/components/govuk_component/summary_list_component.html.erb +11 -0
  24. data/app/components/govuk_component/summary_list_component.rb +61 -0
  25. data/app/components/govuk_component/tab_component.html.erb +11 -0
  26. data/app/components/govuk_component/{tabs.rb → tab_component.rb} +23 -12
  27. data/app/components/govuk_component/{tag.rb → tag_component.rb} +21 -3
  28. data/app/components/govuk_component/warning_text_component.rb +38 -0
  29. data/app/helpers/govuk_components_helper.rb +16 -16
  30. data/lib/govuk/components.rb +1 -0
  31. data/lib/govuk/components/helpers/css_utilities.rb +22 -0
  32. data/lib/govuk/components/version.rb +1 -1
  33. metadata +52 -42
  34. data/app/components/govuk_component/back_link.html.erb +0 -1
  35. data/app/components/govuk_component/details.html.erb +0 -10
  36. data/app/components/govuk_component/details.rb +0 -16
  37. data/app/components/govuk_component/header.html.erb +0 -52
  38. data/app/components/govuk_component/header.rb +0 -65
  39. data/app/components/govuk_component/notification_banner.html.erb +0 -23
  40. data/app/components/govuk_component/panel.html.erb +0 -13
  41. data/app/components/govuk_component/panel.rb +0 -28
  42. data/app/components/govuk_component/phase_banner.html.erb +0 -8
  43. data/app/components/govuk_component/phase_banner.rb +0 -16
  44. data/app/components/govuk_component/start_now_button.html.erb +0 -6
  45. data/app/components/govuk_component/start_now_button.rb +0 -16
  46. data/app/components/govuk_component/summary_list.html.erb +0 -19
  47. data/app/components/govuk_component/summary_list.rb +0 -34
  48. data/app/components/govuk_component/tabs.html.erb +0 -19
  49. data/app/components/govuk_component/warning.html.erb +0 -7
  50. data/app/components/govuk_component/warning.rb +0 -14
@@ -1,2 +1,3 @@
1
1
  require "view_component/engine"
2
+ require "govuk/components/helpers/css_utilities"
2
3
  require "govuk/components/engine"
@@ -0,0 +1,22 @@
1
+ module Govuk
2
+ module Components
3
+ module Helpers
4
+ module CssUtilities
5
+ def combine_classes(default_classes, custom_classes)
6
+ converted_custom_classes = case custom_classes
7
+ when Array
8
+ custom_classes
9
+ when String
10
+ custom_classes.split
11
+ when NilClass
12
+ []
13
+ else
14
+ fail(ArgumentError, "custom classes must be a String, Array or NilClass")
15
+ end
16
+
17
+ default_classes.concat(converted_custom_classes).uniq
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,5 +1,5 @@
1
1
  module Govuk
2
2
  module Components
3
- VERSION = '1.1.8'.freeze
3
+ VERSION = '2.0.0b3'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk-components
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.8
4
+ version: 2.0.0b3
5
5
  platform: ruby
6
6
  authors:
7
7
  - DfE developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-24 00:00:00.000000000 Z
11
+ date: 2021-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: railties
14
+ name: activemodel
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '6.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: activemodel
28
+ name: railties
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.20'
47
+ version: 2.31.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '2.20'
54
+ version: 2.31.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: capybara
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-html-matchers
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.9'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.9'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rspec-rails
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -98,16 +112,16 @@ dependencies:
98
112
  name: rubocop-govuk
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - ">="
115
+ - - '='
102
116
  - !ruby/object:Gem::Version
103
- version: '0'
117
+ version: 4.0.0.pre.1
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - ">="
122
+ - - '='
109
123
  - !ruby/object:Gem::Version
110
- version: '0'
124
+ version: 4.0.0.pre.1
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: sassc-rails
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -161,40 +175,35 @@ files:
161
175
  - MIT-LICENSE
162
176
  - README.md
163
177
  - Rakefile
164
- - app/components/govuk_component/accordion.html.erb
165
- - app/components/govuk_component/accordion.rb
166
- - app/components/govuk_component/back_link.html.erb
167
- - app/components/govuk_component/back_link.rb
178
+ - app/components/govuk_component/accordion_component.html.erb
179
+ - app/components/govuk_component/accordion_component.rb
180
+ - app/components/govuk_component/back_link_component.rb
168
181
  - app/components/govuk_component/base.rb
169
- - app/components/govuk_component/breadcrumbs.html.erb
170
- - app/components/govuk_component/breadcrumbs.rb
171
- - app/components/govuk_component/cookie_banner.html.erb
172
- - app/components/govuk_component/cookie_banner.rb
173
- - app/components/govuk_component/details.html.erb
174
- - app/components/govuk_component/details.rb
175
- - app/components/govuk_component/footer.html.erb
176
- - app/components/govuk_component/footer.rb
177
- - app/components/govuk_component/header.html.erb
178
- - app/components/govuk_component/header.rb
179
- - app/components/govuk_component/inset_text.rb
180
- - app/components/govuk_component/notification_banner.html.erb
181
- - app/components/govuk_component/notification_banner.rb
182
- - app/components/govuk_component/panel.html.erb
183
- - app/components/govuk_component/panel.rb
184
- - app/components/govuk_component/phase_banner.html.erb
185
- - app/components/govuk_component/phase_banner.rb
182
+ - app/components/govuk_component/breadcrumbs_component.html.erb
183
+ - app/components/govuk_component/breadcrumbs_component.rb
184
+ - app/components/govuk_component/cookie_banner_component.html.erb
185
+ - app/components/govuk_component/cookie_banner_component.rb
186
+ - app/components/govuk_component/details_component.rb
187
+ - app/components/govuk_component/footer_component.html.erb
188
+ - app/components/govuk_component/footer_component.rb
189
+ - app/components/govuk_component/header_component.html.erb
190
+ - app/components/govuk_component/header_component.rb
191
+ - app/components/govuk_component/inset_text_component.rb
192
+ - app/components/govuk_component/notification_banner_component.html.erb
193
+ - app/components/govuk_component/notification_banner_component.rb
194
+ - app/components/govuk_component/panel_component.rb
195
+ - app/components/govuk_component/phase_banner_component.html.erb
196
+ - app/components/govuk_component/phase_banner_component.rb
186
197
  - app/components/govuk_component/slot.rb
187
- - app/components/govuk_component/start_now_button.html.erb
188
- - app/components/govuk_component/start_now_button.rb
189
- - app/components/govuk_component/summary_list.html.erb
190
- - app/components/govuk_component/summary_list.rb
191
- - app/components/govuk_component/tabs.html.erb
192
- - app/components/govuk_component/tabs.rb
193
- - app/components/govuk_component/tag.rb
198
+ - app/components/govuk_component/start_button_component.rb
199
+ - app/components/govuk_component/summary_list_component.html.erb
200
+ - app/components/govuk_component/summary_list_component.rb
201
+ - app/components/govuk_component/tab_component.html.erb
202
+ - app/components/govuk_component/tab_component.rb
203
+ - app/components/govuk_component/tag_component.rb
194
204
  - app/components/govuk_component/traits/custom_classes.rb
195
205
  - app/components/govuk_component/traits/custom_html_attributes.rb
196
- - app/components/govuk_component/warning.html.erb
197
- - app/components/govuk_component/warning.rb
206
+ - app/components/govuk_component/warning_text_component.rb
198
207
  - app/helpers/govuk_back_to_top_link_helper.rb
199
208
  - app/helpers/govuk_components_helper.rb
200
209
  - app/helpers/govuk_link_helper.rb
@@ -202,6 +211,7 @@ files:
202
211
  - config/routes.rb
203
212
  - lib/govuk/components.rb
204
213
  - lib/govuk/components/engine.rb
214
+ - lib/govuk/components/helpers/css_utilities.rb
205
215
  - lib/govuk/components/version.rb
206
216
  - lib/tasks/govuk/components_tasks.rake
207
217
  homepage: https://github.com/DFE-Digital/govuk-components
@@ -219,9 +229,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
219
229
  version: '0'
220
230
  required_rubygems_version: !ruby/object:Gem::Requirement
221
231
  requirements:
222
- - - ">="
232
+ - - ">"
223
233
  - !ruby/object:Gem::Version
224
- version: '0'
234
+ version: 1.3.1
225
235
  requirements: []
226
236
  rubygems_version: 3.1.4
227
237
  signing_key:
@@ -1 +0,0 @@
1
- <%= link_to @text, @href, class: classes, **html_attributes %>
@@ -1,10 +0,0 @@
1
- <%= tag.details(class: classes, data: { module: 'govuk-details' }, **html_attributes) do %>
2
- <summary class="govuk-details__summary">
3
- <span class="govuk-details__summary-text">
4
- <%= @summary %>
5
- </span>
6
- </summary>
7
- <div class="govuk-details__text">
8
- <%= content.presence || @description %>
9
- </div>
10
- <% end %>
@@ -1,16 +0,0 @@
1
- class GovukComponent::Details < GovukComponent::Base
2
- attr_accessor :summary, :description
3
-
4
- def initialize(summary:, description: nil, classes: [], html_attributes: {})
5
- super(classes: classes, html_attributes: html_attributes)
6
-
7
- @summary = summary
8
- @description = description
9
- end
10
-
11
- private
12
-
13
- def default_classes
14
- %w(govuk-details)
15
- end
16
- end
@@ -1,52 +0,0 @@
1
- <%= tag.header(class: classes, role: 'banner', data: { module: 'govuk-header' }, **html_attributes) do %>
2
- <div class="govuk-header__container govuk-width-container">
3
- <div class="govuk-header__logo">
4
- <a href=<%= @logo_href %> class="govuk-header__link govuk-header__link--homepage">
5
- <span class="govuk-header__logotype">
6
- <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">
7
- <path fill="currentColor" fill-rule="evenodd" 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"></path>
8
- <image src="/assets/images/govuk-logotype-crown.png" xlink:href="" class="govuk-header__logotype-crown-fallback-image" width="36" height="32"></image>
9
- </svg>
10
- <span class="govuk-header__logotype-text">
11
- <%= @logo %>
12
- </span>
13
- </span>
14
- <% if @product_name.present? %>
15
- <span class="govuk-header__product-name">
16
- <%= @product_name %>
17
- </span>
18
- <% end %>
19
-
20
- <% if product_description.present? %>
21
- <%= product_description.content %>
22
- <% end %>
23
- </a>
24
- </div>
25
- <div class="govuk-header__content">
26
- <% if @service_name.present? %>
27
- <a href="<%= @service_name_href %>" class="govuk-header__link govuk-header__link--service-name">
28
- <%= @service_name %>
29
- </a>
30
- <% end %>
31
-
32
- <% if items.any? %>
33
- <button type="button" class="govuk-header__menu-button govuk-js-header-toggle" aria-controls="navigation" aria-label="Show or hide navigation menu">
34
- <%= menu_button_label %>
35
- </button>
36
- <nav>
37
- <%= tag.ul(class: navigation_classes, aria: { label: "Top Level Navigation" }) do %>
38
- <% items.each do |item| %>
39
- <%= tag.li(class: item.classes.append(item.active_class), **item.html_attributes) do %>
40
- <% if item.link? %>
41
- <%= link_to(item.title, item.href, class: "govuk-header__link") %>
42
- <% else %>
43
- <%= item.title %>
44
- <% end %>
45
- <% end %>
46
- <% end %>
47
- <% end %>
48
- </nav>
49
- <% end %>
50
- </div>
51
- </div>
52
- <% end %>
@@ -1,65 +0,0 @@
1
- class GovukComponent::Header < GovukComponent::Base
2
- include ViewComponent::Slotable
3
-
4
- attr_accessor :logo, :logo_href, :service_name, :service_name_href, :product_name, :menu_button_label
5
-
6
- with_slot :item, collection: true, class_name: 'Item'
7
- wrap_slot :item
8
-
9
- with_slot :product_description
10
- wrap_slot :product_description
11
-
12
- def initialize(logo: 'GOV.UK', logo_href: '/', service_name: nil, service_name_href: '/', product_name: nil, menu_button_label: 'Menu', classes: [], navigation_classes: [], html_attributes: {})
13
- super(classes: classes, html_attributes: html_attributes)
14
-
15
- @logo = logo
16
- @logo_href = logo_href
17
- @service_name = service_name
18
- @service_name_href = service_name_href
19
- @product_name = product_name
20
- @menu_button_label = menu_button_label
21
- @navigation_classes = navigation_classes
22
- end
23
-
24
- private
25
-
26
- def default_classes
27
- %w(govuk-header)
28
- end
29
-
30
- def navigation_classes
31
- %w(govuk-header__navigation).tap { |nc|
32
- nc.concat(@navigation_classes.is_a?(String) ? @navigation_classes.split : @navigation_classes)
33
- }.uniq
34
- end
35
-
36
- class Item < GovukComponent::Slot
37
- attr_accessor :title, :href, :active
38
-
39
- def initialize(title:, href: nil, active: false, classes: [], html_attributes: {})
40
- super(classes: classes, html_attributes: html_attributes)
41
-
42
- self.title = title
43
- self.href = href
44
- self.active = active
45
- end
46
-
47
- def active?
48
- active
49
- end
50
-
51
- def active_class
52
- %w(govuk-header__navigation-item--active) if active?
53
- end
54
-
55
- def link?
56
- href.present?
57
- end
58
-
59
- private
60
-
61
- def default_classes
62
- %w(govuk-header__navigation-item)
63
- end
64
- end
65
- end
@@ -1,23 +0,0 @@
1
- <%= tag.div(class: classes.append(success_class).compact, role: "region", aria: { labelledby: title_id }, data: data_params, **html_attributes) do %>
2
- <div class="govuk-notification-banner__header">
3
- <%= content_tag(title_tag, class: "govuk-notification-banner__title", id: title_id) do %>
4
- <%= title %>
5
- <% end %>
6
- </div>
7
- <div class="govuk-notification-banner__content">
8
- <% headings.each do |heading| %>
9
- <p class="govuk-notification-banner__heading">
10
- <% if heading.text.present? %>
11
- <%= heading.text %>
12
- <% if heading.link_target && heading.link_text %>
13
- <%= link_to(heading.link_text, heading.link_target, class: "govuk-notification-banner__link") %>.
14
- <% end %>
15
- <% else %>
16
- <%= heading.content %>
17
- <% end %>
18
- </p>
19
- <% end %>
20
-
21
- <%= content %>
22
- </div>
23
- <% end %>
@@ -1,13 +0,0 @@
1
- <%= tag.div(class: classes, **html_attributes) do %>
2
- <% if display_title? %>
3
- <h1 class="govuk-panel__title">
4
- <%= @title %>
5
- </h1>
6
- <% end %>
7
-
8
- <% if display_body? %>
9
- <div class="govuk-panel__body">
10
- <%= content.presence || @body %>
11
- </div>
12
- <% end %>
13
- <% end %>
@@ -1,28 +0,0 @@
1
- class GovukComponent::Panel < GovukComponent::Base
2
- attr_accessor :title, :body
3
-
4
- def initialize(title: nil, body: nil, classes: [], html_attributes: {})
5
- super(classes: classes, html_attributes: html_attributes)
6
-
7
- @title = title
8
- @body = body
9
- end
10
-
11
- private
12
-
13
- def default_classes
14
- %w(govuk-panel govuk-panel--confirmation)
15
- end
16
-
17
- def display_title?
18
- @title.present?
19
- end
20
-
21
- def display_body?
22
- [@body, content].any?(&:present?)
23
- end
24
-
25
- def render?
26
- display_title? || display_body?
27
- end
28
- end
@@ -1,8 +0,0 @@
1
- <%= tag.div(class: classes, **html_attributes) do %>
2
- <p class="govuk-phase-banner__content">
3
- <%= render(phase_tag) %>
4
- <span class="govuk-phase-banner__text">
5
- <%= content.presence || @text %>
6
- </span>
7
- </p>
8
- <% end %>
@@ -1,16 +0,0 @@
1
- class GovukComponent::PhaseBanner < GovukComponent::Base
2
- attr_accessor :phase_tag, :text
3
-
4
- def initialize(phase_tag: nil, text: nil, classes: [], html_attributes: {})
5
- super(classes: classes, html_attributes: html_attributes)
6
-
7
- @phase_tag = GovukComponent::Tag.new(classes: "govuk-phase-banner__content__tag", **phase_tag)
8
- @text = text
9
- end
10
-
11
- private
12
-
13
- def default_classes
14
- %w(govuk-phase-banner)
15
- end
16
- end