govuk-components 4.0.0 → 4.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +22 -22
  3. data/app/components/govuk_component/accordion_component/section_component.html.erb +5 -5
  4. data/app/components/govuk_component/accordion_component/section_component.rb +1 -1
  5. data/app/components/govuk_component/accordion_component.rb +1 -1
  6. data/app/components/govuk_component/back_link_component.rb +9 -3
  7. data/app/components/govuk_component/base.rb +4 -0
  8. data/app/components/govuk_component/breadcrumbs_component.html.erb +1 -1
  9. data/app/components/govuk_component/breadcrumbs_component.rb +9 -6
  10. data/app/components/govuk_component/cookie_banner_component/message_component.rb +7 -7
  11. data/app/components/govuk_component/cookie_banner_component.rb +1 -1
  12. data/app/components/govuk_component/details_component.rb +5 -5
  13. data/app/components/govuk_component/exit_this_page_component.rb +56 -0
  14. data/app/components/govuk_component/footer_component.html.erb +11 -11
  15. data/app/components/govuk_component/footer_component.rb +7 -7
  16. data/app/components/govuk_component/header_component.html.erb +10 -10
  17. data/app/components/govuk_component/header_component.rb +8 -8
  18. data/app/components/govuk_component/inset_text_component.rb +1 -1
  19. data/app/components/govuk_component/notification_banner_component.html.erb +3 -3
  20. data/app/components/govuk_component/notification_banner_component.rb +5 -5
  21. data/app/components/govuk_component/pagination_component/adjacent_page.rb +6 -6
  22. data/app/components/govuk_component/pagination_component/item.rb +4 -4
  23. data/app/components/govuk_component/pagination_component/next_page.rb +1 -1
  24. data/app/components/govuk_component/pagination_component/previous_page.rb +1 -1
  25. data/app/components/govuk_component/pagination_component.rb +4 -4
  26. data/app/components/govuk_component/panel_component.rb +3 -3
  27. data/app/components/govuk_component/phase_banner_component.html.erb +2 -2
  28. data/app/components/govuk_component/phase_banner_component.rb +2 -2
  29. data/app/components/govuk_component/section_break_component.rb +3 -3
  30. data/app/components/govuk_component/start_button_component.rb +8 -10
  31. data/app/components/govuk_component/summary_list_component/action_component.rb +1 -1
  32. data/app/components/govuk_component/summary_list_component/card_component.html.erb +5 -5
  33. data/app/components/govuk_component/summary_list_component/card_component.rb +1 -1
  34. data/app/components/govuk_component/summary_list_component/key_component.rb +1 -1
  35. data/app/components/govuk_component/summary_list_component/row_component.rb +5 -5
  36. data/app/components/govuk_component/summary_list_component/value_component.rb +1 -1
  37. data/app/components/govuk_component/summary_list_component.rb +2 -2
  38. data/app/components/govuk_component/tab_component.html.erb +2 -2
  39. data/app/components/govuk_component/tab_component.rb +5 -5
  40. data/app/components/govuk_component/table_component/body_component.rb +1 -1
  41. data/app/components/govuk_component/table_component/caption_component.rb +2 -2
  42. data/app/components/govuk_component/table_component/cell_component.rb +12 -10
  43. data/app/components/govuk_component/table_component/foot_component.rb +1 -1
  44. data/app/components/govuk_component/table_component/head_component.rb +1 -1
  45. data/app/components/govuk_component/table_component/row_component.rb +1 -1
  46. data/app/components/govuk_component/table_component.rb +1 -1
  47. data/app/components/govuk_component/tag_component.rb +2 -2
  48. data/app/components/govuk_component/warning_text_component.rb +4 -4
  49. data/app/helpers/govuk_back_to_top_link_helper.rb +7 -1
  50. data/app/helpers/govuk_components_helper.rb +1 -0
  51. data/app/helpers/govuk_exit_this_page_link_helper.rb +23 -0
  52. data/app/helpers/govuk_link_helper.rb +38 -26
  53. data/app/helpers/govuk_skip_link_helper.rb +2 -2
  54. data/app/helpers/title_with_error_prefix_helper.rb +7 -0
  55. data/lib/govuk/components/engine.rb +16 -2
  56. data/lib/govuk/components/version.rb +1 -1
  57. metadata +21 -12
@@ -1,10 +1,10 @@
1
1
  <%= tag.div(**html_attributes) do %>
2
- <div class="govuk-notification-banner__header">
3
- <%= content_tag(title_tag, class: "govuk-notification-banner__title", id: title_id) do %>
2
+ <div class="<%= brand %>-notification-banner__header">
3
+ <%= content_tag(title_tag, class: "#{brand}-notification-banner__title", id: title_id) do %>
4
4
  <%= title_content %>
5
5
  <% end %>
6
6
  </div>
7
- <div class="govuk-notification-banner__content">
7
+ <div class="<%= brand %>-notification-banner__content">
8
8
  <% headings.each do |heading| %>
9
9
  <%= heading %>
10
10
  <% end %>
@@ -52,11 +52,11 @@ class GovukComponent::NotificationBannerComponent < GovukComponent::Base
52
52
  end
53
53
 
54
54
  def link
55
- link_to(link_text, link_href, class: 'govuk-notification-banner__link') if link_text.present? && link_href.present?
55
+ link_to(link_text, link_href, class: "#{brand}-notification-banner__link") if link_text.present? && link_href.present?
56
56
  end
57
57
 
58
58
  def default_attributes
59
- { class: %w(govuk-notification-banner__heading) }
59
+ { class: ["#{brand}-notification-banner__heading"] }
60
60
  end
61
61
  end
62
62
 
@@ -65,11 +65,11 @@ private
65
65
  def default_attributes
66
66
  {
67
67
  class: class_names(
68
- "govuk-notification-banner",
69
- "govuk-notification-banner--success" => success
68
+ "#{brand}-notification-banner",
69
+ "#{brand}-notification-banner--success" => success
70
70
  ),
71
71
  data: {
72
- "module" => "govuk-notification-banner",
72
+ "module" => "#{brand}-notification-banner",
73
73
  "disable-auto-focus" => disable_auto_focus
74
74
  },
75
75
  role: role,
@@ -14,7 +14,7 @@ class GovukComponent::PaginationComponent::AdjacentPage < GovukComponent::Base
14
14
 
15
15
  def call
16
16
  tag.div(**html_attributes) do
17
- tag.a(href: href, class: %w(govuk-link govuk-pagination__link), rel: suffix) do
17
+ tag.a(href: href, class: ["#{brand}-link", "#{brand}-pagination__link"], rel: suffix) do
18
18
  safe_join([body, divider, label_content])
19
19
  end
20
20
  end
@@ -23,7 +23,7 @@ class GovukComponent::PaginationComponent::AdjacentPage < GovukComponent::Base
23
23
  private
24
24
 
25
25
  def default_attributes
26
- { class: ["govuk-pagination__#{suffix}"] }
26
+ { class: ["#{brand}-pagination__#{suffix}"] }
27
27
  end
28
28
 
29
29
  def body
@@ -37,7 +37,7 @@ private
37
37
  def divider
38
38
  return if label_text.blank?
39
39
 
40
- tag.span(":", class: %w(govuk-visually-hidden))
40
+ tag.span(":", class: "#{brand}-visually-hidden")
41
41
  end
42
42
 
43
43
  def label_content
@@ -48,12 +48,12 @@ private
48
48
 
49
49
  def title_classes
50
50
  class_names(
51
- %(govuk-pagination__link-title),
52
- %(govuk-pagination__link-title--decorated) => label_text.blank?
51
+ "#{brand}-pagination__link-title",
52
+ "#{brand}-pagination__link-title--decorated" => label_text.blank?
53
53
  )
54
54
  end
55
55
 
56
56
  def label_classes
57
- %w(govuk-pagination__link-label)
57
+ "#{brand}-pagination__link-label"
58
58
  end
59
59
  end
@@ -53,20 +53,20 @@ private
53
53
  end
54
54
 
55
55
  def link(current: false)
56
- attributes = html_attributes.tap { |ha| ha[:class] << "govuk-pagination__item--current" if current }
56
+ attributes = html_attributes.tap { |ha| ha[:class] << "#{brand}-pagination__item--current" if current }
57
57
 
58
58
  tag.li(**attributes) do
59
- tag.a(href: href, class: %w(govuk-link govuk-pagination__link)) { number.to_s }
59
+ tag.a(href: href, class: ["#{brand}-link", "#{brand}-pagination__link"]) { number.to_s }
60
60
  end
61
61
  end
62
62
 
63
63
  def ellipsis_item
64
- tag.li("⋯", class: %w(govuk-pagination__item govuk-pagination__item--ellipses))
64
+ tag.li("⋯", class: ["#{brand}-pagination__item", "#{brand}-pagination__item--ellipses"])
65
65
  end
66
66
 
67
67
  def default_attributes
68
68
  {
69
- class: %w(govuk-pagination__item),
69
+ class: ["#{brand}-pagination__item"],
70
70
  aria: { label: aria_label }
71
71
  }
72
72
  end
@@ -20,7 +20,7 @@ class GovukComponent::PaginationComponent::NextPage < GovukComponent::Pagination
20
20
  private
21
21
 
22
22
  def arrow
23
- tag.svg(class: "govuk-pagination__icon govuk-pagination__icon--next", xmlns: "http://www.w3.org/2000/svg", height: "13", width: "15", focusable: "false", viewBox: "0 0 15 13", aria: { hidden: "true" }) do
23
+ tag.svg(class: "#{brand}-pagination__icon #{brand}-pagination__icon--next", xmlns: "http://www.w3.org/2000/svg", height: "13", width: "15", focusable: "false", viewBox: "0 0 15 13", aria: { hidden: "true" }) do
24
24
  tag.path(d: "m8.107-0.0078125-1.4136 1.414 4.2926 4.293h-12.986v2h12.896l-4.1855 3.9766 1.377 1.4492 6.7441-6.4062-6.7246-6.7266z")
25
25
  end
26
26
  end
@@ -14,7 +14,7 @@ class GovukComponent::PaginationComponent::PreviousPage < GovukComponent::Pagina
14
14
  private
15
15
 
16
16
  def arrow
17
- tag.svg(class: "govuk-pagination__icon govuk-pagination__icon--prev", xmlns: "http://www.w3.org/2000/svg", height: "13", width: "15", focusable: "false", viewBox: "0 0 15 13", aria: { hidden: "true" }) do
17
+ tag.svg(class: "#{brand}-pagination__icon #{brand}-pagination__icon--prev", xmlns: "http://www.w3.org/2000/svg", height: "13", width: "15", focusable: "false", viewBox: "0 0 15 13", aria: { hidden: "true" }) do
18
18
  tag.path(d: "m6.5938-0.0078125-6.7266 6.7266 6.7441 6.4062 1.377-1.449-4.1856-3.9768h12.896v-2h-12.984l4.2931-4.293-1.414-1.414z")
19
19
  end
20
20
  end
@@ -66,12 +66,12 @@ class GovukComponent::PaginationComponent < GovukComponent::Base
66
66
  end
67
67
 
68
68
  def call
69
- attributes = html_attributes.tap { |ha| (ha[:class] << "govuk-pagination--block") if items.empty? }
69
+ attributes = html_attributes.tap { |ha| (ha[:class] << "#{brand}-pagination--block") if items.empty? }
70
70
 
71
71
  tag.nav(**attributes) do
72
72
  safe_join([
73
73
  previous_content,
74
- tag.ul(class: "govuk-pagination__list") { safe_join(page_items) },
74
+ tag.ul(class: "#{brand}-pagination__list") { safe_join(page_items) },
75
75
  next_content
76
76
  ])
77
77
  end
@@ -85,7 +85,7 @@ class GovukComponent::PaginationComponent < GovukComponent::Base
85
85
  private
86
86
 
87
87
  def default_attributes
88
- { role: "navigation", aria: { label: landmark_label }, class: %w(govuk-pagination) }
88
+ { role: "navigation", aria: { label: landmark_label }, class: "#{brand}-pagination" }
89
89
  end
90
90
 
91
91
  def build_previous
@@ -124,6 +124,6 @@ private
124
124
 
125
125
  return visible if hidden.blank?
126
126
 
127
- (visible + tag.span(" #{hidden}", class: "govuk-visually-hidden")).html_safe
127
+ (visible + tag.span(" #{hidden}", class: "#{brand}-visually-hidden")).html_safe
128
128
  end
129
129
  end
@@ -21,7 +21,7 @@ class GovukComponent::PanelComponent < GovukComponent::Base
21
21
  private
22
22
 
23
23
  def default_attributes
24
- { class: %w(govuk-panel govuk-panel--confirmation) }
24
+ { class: "#{brand}-panel #{brand}-panel--confirmation" }
25
25
  end
26
26
 
27
27
  def heading_tag
@@ -39,13 +39,13 @@ private
39
39
  def panel_title
40
40
  return if title.blank?
41
41
 
42
- content_tag(heading_tag, title, class: "govuk-panel__title")
42
+ content_tag(heading_tag, title, class: "#{brand}-panel__title")
43
43
  end
44
44
 
45
45
  def panel_body
46
46
  return if panel_content.blank?
47
47
 
48
- tag.div(class: "govuk-panel__body") do
48
+ tag.div(class: "#{brand}-panel__body") do
49
49
  panel_content
50
50
  end
51
51
  end
@@ -1,6 +1,6 @@
1
1
  <%= tag.div(**html_attributes) do %>
2
- <p class="govuk-phase-banner__content">
2
+ <p class="<%= brand %>-phase-banner__content">
3
3
  <%= render(phase_tag_component) %>
4
- <%= tag.span((content.presence || @text), class: "govuk-phase-banner__text") %>
4
+ <%= tag.span((content.presence || @text), class: "#{brand}-phase-banner__text") %>
5
5
  </p>
6
6
  <% end %>
@@ -14,12 +14,12 @@ class GovukComponent::PhaseBannerComponent < GovukComponent::Base
14
14
  end
15
15
 
16
16
  def phase_tag_component
17
- GovukComponent::TagComponent.new(**phase_tag.deep_merge(classes: "govuk-phase-banner__content__tag"))
17
+ GovukComponent::TagComponent.new(**phase_tag.deep_merge(classes: "#{brand}-phase-banner__content__tag"))
18
18
  end
19
19
 
20
20
  private
21
21
 
22
22
  def default_attributes
23
- { class: %w(govuk-phase-banner) }
23
+ { class: "#{brand}-phase-banner" }
24
24
  end
25
25
  end
@@ -27,9 +27,9 @@ private
27
27
 
28
28
  def default_classes
29
29
  class_names(
30
- "govuk-section-break",
30
+ "#{brand}-section-break",
31
31
  size_class,
32
- "govuk-section-break--visible" => visible?
32
+ "#{brand}-section-break--visible" => visible?
33
33
  ).split
34
34
  end
35
35
 
@@ -37,7 +37,7 @@ private
37
37
  if size.blank?
38
38
  ""
39
39
  elsif size.in?(SIZES)
40
- "govuk-section-break--#{size}"
40
+ "#{brand}-section-break--#{size}"
41
41
  else
42
42
  raise ArgumentError, "invalid size #{size}, supported sizes are #{SIZES.to_sentence}"
43
43
  end
@@ -1,11 +1,4 @@
1
1
  class GovukComponent::StartButtonComponent < GovukComponent::Base
2
- BUTTON_ATTRIBUTES = {
3
- draggable: 'false',
4
- data: { module: 'govuk-button' }
5
- }.freeze
6
-
7
- LINK_ATTRIBUTES = BUTTON_ATTRIBUTES.merge({ role: 'button' }).freeze
8
-
9
2
  attr_reader :text, :href, :as_button
10
3
 
11
4
  def initialize(text:, href:, as_button: config.default_start_button_as_button, classes: [], html_attributes: {})
@@ -31,8 +24,13 @@ class GovukComponent::StartButtonComponent < GovukComponent::Base
31
24
  private
32
25
 
33
26
  def default_attributes
34
- (as_button ? BUTTON_ATTRIBUTES : LINK_ATTRIBUTES)
35
- .merge({ class: %w(govuk-button govuk-button--start) })
27
+ attrs = {
28
+ class: ["#{brand}-button", "#{brand}-button--start"],
29
+ data: { module: "#{brand}-button" },
30
+ draggable: 'false',
31
+ }
32
+ attrs.merge!(role: 'button') unless as_button
33
+ attrs
36
34
  end
37
35
 
38
36
  def icon
@@ -43,7 +41,7 @@ private
43
41
 
44
42
  def svg_attributes
45
43
  {
46
- class: "govuk-button__start-icon",
44
+ class: "#{brand}-button__start-icon",
47
45
  xmlns: "http://www.w3.org/2000/svg",
48
46
  width: "17.5",
49
47
  height: "19",
@@ -37,6 +37,6 @@ private
37
37
  end
38
38
 
39
39
  def visually_hidden_span
40
- tag.span(%( #{visually_hidden_text}), class: "govuk-visually-hidden") if visually_hidden_text.present?
40
+ tag.span(%( #{visually_hidden_text}), class: "#{brand}-visually-hidden") if visually_hidden_text.present?
41
41
  end
42
42
  end
@@ -1,16 +1,16 @@
1
1
  <%= tag.div(**html_attributes) do %>
2
- <div class="govuk-summary-card__title-wrapper">
3
- <%= tag.h2(title, class: "govuk-summary-card__title") %>
2
+ <div class="<%= brand %>-summary-card__title-wrapper">
3
+ <%= tag.h2(title, class: "#{brand}-summary-card__title") %>
4
4
 
5
5
  <% if actions.any? %>
6
- <ul class="govuk-summary-card__actions">
6
+ <ul class="<%= brand %>-summary-card__actions">
7
7
  <% actions.each do |action| %>
8
- <%= tag.li(action, class: "govuk-summary-card__action") %>
8
+ <%= tag.li(action, class: "#{brand}-summary-card__action") %>
9
9
  <% end %>
10
10
  </ul>
11
11
  <% end %>
12
12
  </div>
13
- <div class="govuk-summary-card__content">
13
+ <div class="<%= brand %>-summary-card__content">
14
14
  <%= summary_list || content %>
15
15
  </div>
16
16
  <% end %>
@@ -14,6 +14,6 @@ class GovukComponent::SummaryListComponent::CardComponent < GovukComponent::Base
14
14
  private
15
15
 
16
16
  def default_attributes
17
- { class: %w(govuk-summary-card) }
17
+ { class: "#{brand}-summary-card" }
18
18
  end
19
19
  end
@@ -14,7 +14,7 @@ class GovukComponent::SummaryListComponent::KeyComponent < GovukComponent::Base
14
14
  private
15
15
 
16
16
  def default_attributes
17
- { class: %w(govuk-summary-list__key) }
17
+ { class: "#{brand}-summary-list__key" }
18
18
  end
19
19
 
20
20
  def key_content
@@ -37,21 +37,21 @@ private
37
37
 
38
38
  def actions_list
39
39
  tag.dd(class: actions_class) do
40
- tag.ul(class: "govuk-summary-list__actions-list") do
41
- safe_join(actions.map { |action| tag.li(action, class: "govuk-summary-list__actions-list-item") })
40
+ tag.ul(class: "#{brand}-summary-list__actions-list") do
41
+ safe_join(actions.map { |action| tag.li(action, class: "#{brand}-summary-list__actions-list-item") })
42
42
  end
43
43
  end
44
44
  end
45
45
 
46
46
  def default_attributes
47
- { class: %w(govuk-summary-list__row) }
47
+ { class: "#{brand}-summary-list__row" }
48
48
  end
49
49
 
50
50
  def actions_class
51
- "govuk-summary-list__actions"
51
+ "#{brand}-summary-list__actions"
52
52
  end
53
53
 
54
54
  def no_actions_class
55
- "govuk-summary-list__row--no-actions"
55
+ "#{brand}-summary-list__row--no-actions"
56
56
  end
57
57
  end
@@ -14,7 +14,7 @@ class GovukComponent::SummaryListComponent::ValueComponent < GovukComponent::Bas
14
14
  private
15
15
 
16
16
  def default_attributes
17
- { class: %w(govuk-summary-list__value) }
17
+ { class: "#{brand}-summary-list__value" }
18
18
  end
19
19
 
20
20
  def value_content
@@ -39,11 +39,11 @@ module GovukComponent
39
39
  end
40
40
 
41
41
  def borders_class
42
- %(govuk-summary-list--no-border) unless borders
42
+ "#{brand}-summary-list--no-border" unless borders
43
43
  end
44
44
 
45
45
  def default_attributes
46
- { class: ["govuk-summary-list", borders_class].compact }
46
+ { class: ["#{brand}-summary-list", borders_class].compact }
47
47
  end
48
48
 
49
49
  def build(rows)
@@ -1,6 +1,6 @@
1
1
  <%= tag.div(**html_attributes) do %>
2
- <%= tag.h2(title, class: "govuk-tabs__title") %>
3
- <ul class="govuk-tabs__list">
2
+ <%= tag.h2(title, class: "#{brand}-tabs__title") %>
3
+ <ul class="<%= brand %>-tabs__list">
4
4
  <% tabs.each.with_index do |tab, i| %>
5
5
  <%= tag.li(tab.li_link, class: tab.li_classes(i)) %>
6
6
  <% end %>
@@ -15,7 +15,7 @@ class GovukComponent::TabComponent < GovukComponent::Base
15
15
  private
16
16
 
17
17
  def default_attributes
18
- { id: id, class: %w(govuk-tabs), data: { module: 'govuk-tabs' } }
18
+ { id: id, class: "#{brand}-tabs", data: { module: "#{brand}-tabs" } }
19
19
  end
20
20
 
21
21
  class Tab < GovukComponent::Base
@@ -35,19 +35,19 @@ private
35
35
  def hidden_class(i = nil)
36
36
  return [] if i&.zero?
37
37
 
38
- %w(govuk-tabs__panel--hidden)
38
+ ["#{brand}-tabs__panel--hidden"]
39
39
  end
40
40
 
41
41
  def li_classes(i = nil)
42
- class_names("govuk-tabs__list-item", "govuk-tabs__list-item--selected" => i&.zero?).split
42
+ class_names("#{brand}-tabs__list-item", "#{brand}-tabs__list-item--selected" => i&.zero?).split
43
43
  end
44
44
 
45
45
  def li_link
46
- link_to(label, id(prefix: '#'), class: "govuk-tabs__tab")
46
+ link_to(label, id(prefix: '#'), class: "#{brand}-tabs__tab")
47
47
  end
48
48
 
49
49
  def default_attributes
50
- { id: id, class: %w(govuk-tabs__panel) }
50
+ { id: id, class: "#{brand}-tabs__panel" }
51
51
  end
52
52
 
53
53
  def combined_attributes(i)
@@ -28,6 +28,6 @@ private
28
28
  end
29
29
 
30
30
  def default_attributes
31
- { class: %w(govuk-table__body) }
31
+ { class: "#{brand}-table__body" }
32
32
  end
33
33
  end
@@ -26,12 +26,12 @@ private
26
26
  end
27
27
 
28
28
  def default_attributes
29
- { class: class_names("govuk-table__caption", caption_size_class => size).split }
29
+ { class: class_names("#{brand}-table__caption", caption_size_class => size).split }
30
30
  end
31
31
 
32
32
  def caption_size_class
33
33
  fail(ArgumentError, "bad size #{size}, must be in #{SIZES}") unless size.in?(SIZES)
34
34
 
35
- %(govuk-table__caption--#{size})
35
+ "#{brand}-table__caption--#{size}"
36
36
  end
37
37
  end
@@ -4,14 +4,16 @@ class GovukComponent::TableComponent::CellComponent < GovukComponent::Base
4
4
  alias_method :numeric?, :numeric
5
5
  alias_method :header?, :header
6
6
 
7
- WIDTHS = {
8
- "full" => "govuk-!-width-full",
9
- "three-quarters" => "govuk-!-width-three-quarters",
10
- "two-thirds" => "govuk-!-width-two-thirds",
11
- "one-half" => "govuk-!-width-one-half",
12
- "one-third" => "govuk-!-width-one-third",
13
- "one-quarter" => "govuk-!-width-one-quarter",
14
- }.freeze
7
+ def self.widths
8
+ {
9
+ "full" => "#{brand}-!-width-full",
10
+ "three-quarters" => "#{brand}-!-width-three-quarters",
11
+ "two-thirds" => "#{brand}-!-width-two-thirds",
12
+ "one-half" => "#{brand}-!-width-one-half",
13
+ "one-third" => "#{brand}-!-width-one-third",
14
+ "one-quarter" => "#{brand}-!-width-one-quarter",
15
+ }.freeze
16
+ end
15
17
 
16
18
  def initialize(scope: nil, header: nil, numeric: false, text: nil, width: nil, parent: nil, rowspan: nil, colspan: nil, classes: [], html_attributes: {})
17
19
  @text = text
@@ -71,8 +73,8 @@ private
71
73
 
72
74
  def default_classes
73
75
  class_names(
74
- "govuk-table__#{class_suffix}",
75
- "govuk-table__#{class_suffix}--numeric" => numeric?,
76
+ "#{brand}-table__#{class_suffix}",
77
+ "#{brand}-table__#{class_suffix}--numeric" => numeric?,
76
78
  width => width?,
77
79
  )
78
80
  end
@@ -39,6 +39,6 @@ private
39
39
  end
40
40
 
41
41
  def default_attributes
42
- { class: %w(govuk-table__foot) }
42
+ { class: "#{brand}-table__foot" }
43
43
  end
44
44
  end
@@ -29,6 +29,6 @@ private
29
29
  end
30
30
 
31
31
  def default_attributes
32
- { class: %w(govuk-table__head) }
32
+ { class: "#{brand}-table__head" }
33
33
  end
34
34
  end
@@ -68,7 +68,7 @@ private
68
68
  end
69
69
 
70
70
  def default_attributes
71
- { class: %w(govuk-table__row) }
71
+ { class: "#{brand}-table__row" }
72
72
  end
73
73
 
74
74
  def in_thead?
@@ -37,7 +37,7 @@ module GovukComponent
37
37
  end
38
38
 
39
39
  def default_attributes
40
- { id: id, class: %w(govuk-table) }
40
+ { id: id, class: "#{brand}-table" }
41
41
  end
42
42
  end
43
43
  end
@@ -22,7 +22,7 @@ private
22
22
 
23
23
  def default_attributes
24
24
  {
25
- class: ["govuk-tag", colour_class]
25
+ class: ["#{brand}-tag", colour_class]
26
26
  }
27
27
  end
28
28
 
@@ -31,7 +31,7 @@ private
31
31
 
32
32
  fail(ArgumentError, colour_error_message) unless valid_colour?
33
33
 
34
- %(govuk-tag--#{colour})
34
+ "#{brand}-tag--#{colour}"
35
35
  end
36
36
 
37
37
  def valid_colour?
@@ -18,20 +18,20 @@ class GovukComponent::WarningTextComponent < GovukComponent::Base
18
18
  private
19
19
 
20
20
  def icon_element
21
- tag.span(icon, class: 'govuk-warning-text__icon', aria: { hidden: true })
21
+ tag.span(icon, class: "#{brand}-warning-text__icon", aria: { hidden: true })
22
22
  end
23
23
 
24
24
  def warning_text
25
- tag.strong(class: 'govuk-warning-text__text') do
25
+ tag.strong(class: "#{brand}-warning-text__text") do
26
26
  safe_join([assistive, (content || text)])
27
27
  end
28
28
  end
29
29
 
30
30
  def assistive
31
- tag.span(icon_fallback_text, class: 'govuk-warning-text__assistive')
31
+ tag.span(icon_fallback_text, class: "#{brand}-warning-text__assistive")
32
32
  end
33
33
 
34
34
  def default_attributes
35
- { class: %w(govuk-warning-text) }
35
+ { class: "#{brand}-warning-text" }
36
36
  end
37
37
  end
@@ -1,6 +1,6 @@
1
1
  module GovukBackToTopLinkHelper
2
2
  def govuk_back_to_top_link(target = '#top')
3
- link_to(target, class: 'govuk-link govuk-link--no-visited-state') do
3
+ link_to(target, class: "#{brand}-link #{brand}-link--no-visited-state") do
4
4
  <<-HTML.squish.html_safe
5
5
  <svg class="app-back-to-top__icon" xmlns="http://www.w3.org/2000/svg" width="13" height="17" viewBox="0 0 13 17">
6
6
  <path fill="currentColor" d="M6.5 0L0 6.5 1.4 8l4-4v12.7h2V4l4.3 4L13 6.4z"></path>
@@ -9,6 +9,12 @@ module GovukBackToTopLinkHelper
9
9
  HTML
10
10
  end
11
11
  end
12
+
13
+ private
14
+
15
+ def brand
16
+ Govuk::Components.brand
17
+ end
12
18
  end
13
19
 
14
20
  ActiveSupport.on_load(:action_view) { include GovukBackToTopLinkHelper }
@@ -5,6 +5,7 @@ module GovukComponentsHelper
5
5
  govuk_breadcrumbs: 'GovukComponent::BreadcrumbsComponent',
6
6
  govuk_cookie_banner: 'GovukComponent::CookieBannerComponent',
7
7
  govuk_details: 'GovukComponent::DetailsComponent',
8
+ govuk_exit_this_page: 'GovukComponent::ExitThisPageComponent',
8
9
  govuk_footer: 'GovukComponent::FooterComponent',
9
10
  govuk_header: 'GovukComponent::HeaderComponent',
10
11
  govuk_inset_text: 'GovukComponent::InsetTextComponent',
@@ -0,0 +1,23 @@
1
+ module GovukExitThisPageLinkHelper
2
+ def govuk_exit_this_page_link(
3
+ text: Govuk::Components.config.default_exit_this_page_text,
4
+ href: Govuk::Components.config.default_exit_this_page_redirect_url,
5
+ classes: [],
6
+ **html_attributes,
7
+ &block
8
+ )
9
+ link_classes = Array.wrap(classes).append(["#{brand}-skip-link", "#{brand}-js-exit-this-page-skiplink"])
10
+
11
+ html_attributes_with_data_module = { data: { module: "#{brand}-skip-link" } }.deep_merge(html_attributes)
12
+
13
+ link_to(text, href, class: link_classes, **html_attributes_with_data_module, &block)
14
+ end
15
+
16
+ private
17
+
18
+ def brand
19
+ Govuk::Components.brand
20
+ end
21
+ end
22
+
23
+ ActiveSupport.on_load(:action_view) { include GovukExitThisPageLinkHelper }