govuk-components 4.0.0 → 4.1.1
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.
- checksums.yaml +4 -4
- data/README.md +22 -22
- data/app/components/govuk_component/accordion_component/section_component.html.erb +5 -5
- data/app/components/govuk_component/accordion_component/section_component.rb +1 -1
- data/app/components/govuk_component/accordion_component.rb +1 -1
- data/app/components/govuk_component/back_link_component.rb +9 -3
- data/app/components/govuk_component/base.rb +4 -0
- data/app/components/govuk_component/breadcrumbs_component.html.erb +1 -1
- data/app/components/govuk_component/breadcrumbs_component.rb +9 -6
- data/app/components/govuk_component/cookie_banner_component/message_component.rb +7 -7
- data/app/components/govuk_component/cookie_banner_component.rb +1 -1
- data/app/components/govuk_component/details_component.rb +5 -5
- data/app/components/govuk_component/exit_this_page_component.rb +56 -0
- data/app/components/govuk_component/footer_component.html.erb +11 -11
- data/app/components/govuk_component/footer_component.rb +7 -7
- data/app/components/govuk_component/header_component.html.erb +10 -10
- data/app/components/govuk_component/header_component.rb +8 -8
- data/app/components/govuk_component/inset_text_component.rb +1 -1
- data/app/components/govuk_component/notification_banner_component.html.erb +3 -3
- data/app/components/govuk_component/notification_banner_component.rb +5 -5
- data/app/components/govuk_component/pagination_component/adjacent_page.rb +6 -6
- data/app/components/govuk_component/pagination_component/item.rb +4 -4
- data/app/components/govuk_component/pagination_component/next_page.rb +1 -1
- data/app/components/govuk_component/pagination_component/previous_page.rb +1 -1
- data/app/components/govuk_component/pagination_component.rb +4 -4
- data/app/components/govuk_component/panel_component.rb +3 -3
- data/app/components/govuk_component/phase_banner_component.html.erb +2 -2
- data/app/components/govuk_component/phase_banner_component.rb +2 -2
- data/app/components/govuk_component/section_break_component.rb +3 -3
- data/app/components/govuk_component/start_button_component.rb +8 -10
- data/app/components/govuk_component/summary_list_component/action_component.rb +1 -1
- data/app/components/govuk_component/summary_list_component/card_component.html.erb +5 -5
- data/app/components/govuk_component/summary_list_component/card_component.rb +1 -1
- data/app/components/govuk_component/summary_list_component/key_component.rb +1 -1
- data/app/components/govuk_component/summary_list_component/row_component.rb +5 -5
- data/app/components/govuk_component/summary_list_component/value_component.rb +1 -1
- data/app/components/govuk_component/summary_list_component.rb +2 -2
- data/app/components/govuk_component/tab_component.html.erb +2 -2
- data/app/components/govuk_component/tab_component.rb +5 -5
- data/app/components/govuk_component/table_component/body_component.rb +1 -1
- data/app/components/govuk_component/table_component/caption_component.rb +2 -2
- data/app/components/govuk_component/table_component/cell_component.rb +12 -10
- data/app/components/govuk_component/table_component/foot_component.rb +1 -1
- data/app/components/govuk_component/table_component/head_component.rb +1 -1
- data/app/components/govuk_component/table_component/row_component.rb +1 -1
- data/app/components/govuk_component/table_component.rb +1 -1
- data/app/components/govuk_component/tag_component.rb +2 -2
- data/app/components/govuk_component/warning_text_component.rb +4 -4
- data/app/helpers/govuk_back_to_top_link_helper.rb +7 -1
- data/app/helpers/govuk_components_helper.rb +1 -0
- data/app/helpers/govuk_exit_this_page_link_helper.rb +23 -0
- data/app/helpers/govuk_link_helper.rb +38 -26
- data/app/helpers/govuk_skip_link_helper.rb +2 -2
- data/app/helpers/title_with_error_prefix_helper.rb +7 -0
- data/lib/govuk/components/engine.rb +16 -2
- data/lib/govuk/components/version.rb +1 -1
- metadata +21 -12
@@ -1,10 +1,10 @@
|
|
1
1
|
<%= tag.div(**html_attributes) do %>
|
2
|
-
<div class="
|
3
|
-
<%= content_tag(title_tag, class: "
|
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="
|
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:
|
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:
|
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
|
-
"
|
69
|
-
"
|
68
|
+
"#{brand}-notification-banner",
|
69
|
+
"#{brand}-notification-banner--success" => success
|
70
70
|
),
|
71
71
|
data: {
|
72
|
-
"module" => "
|
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:
|
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: ["
|
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:
|
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
|
-
|
52
|
-
|
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
|
-
|
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] << "
|
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:
|
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:
|
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:
|
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: "
|
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: "
|
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] << "
|
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: "
|
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:
|
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: "
|
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:
|
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: "
|
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: "
|
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="
|
2
|
+
<p class="<%= brand %>-phase-banner__content">
|
3
3
|
<%= render(phase_tag_component) %>
|
4
|
-
<%= tag.span((content.presence || @text), class: "
|
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: "
|
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:
|
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
|
-
"
|
30
|
+
"#{brand}-section-break",
|
31
31
|
size_class,
|
32
|
-
"
|
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
|
-
"
|
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
|
-
|
35
|
-
|
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: "
|
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: "
|
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="
|
3
|
-
<%= tag.h2(title, class: "
|
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="
|
6
|
+
<ul class="<%= brand %>-summary-card__actions">
|
7
7
|
<% actions.each do |action| %>
|
8
|
-
<%= tag.li(action, class: "
|
8
|
+
<%= tag.li(action, class: "#{brand}-summary-card__action") %>
|
9
9
|
<% end %>
|
10
10
|
</ul>
|
11
11
|
<% end %>
|
12
12
|
</div>
|
13
|
-
<div class="
|
13
|
+
<div class="<%= brand %>-summary-card__content">
|
14
14
|
<%= summary_list || content %>
|
15
15
|
</div>
|
16
16
|
<% end %>
|
@@ -37,21 +37,21 @@ private
|
|
37
37
|
|
38
38
|
def actions_list
|
39
39
|
tag.dd(class: actions_class) do
|
40
|
-
tag.ul(class: "
|
41
|
-
safe_join(actions.map { |action| tag.li(action, class: "
|
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:
|
47
|
+
{ class: "#{brand}-summary-list__row" }
|
48
48
|
end
|
49
49
|
|
50
50
|
def actions_class
|
51
|
-
"
|
51
|
+
"#{brand}-summary-list__actions"
|
52
52
|
end
|
53
53
|
|
54
54
|
def no_actions_class
|
55
|
-
"
|
55
|
+
"#{brand}-summary-list__row--no-actions"
|
56
56
|
end
|
57
57
|
end
|
@@ -39,11 +39,11 @@ module GovukComponent
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def borders_class
|
42
|
-
|
42
|
+
"#{brand}-summary-list--no-border" unless borders
|
43
43
|
end
|
44
44
|
|
45
45
|
def default_attributes
|
46
|
-
{ class: ["
|
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: "
|
3
|
-
<ul class="
|
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:
|
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
|
-
|
38
|
+
["#{brand}-tabs__panel--hidden"]
|
39
39
|
end
|
40
40
|
|
41
41
|
def li_classes(i = nil)
|
42
|
-
class_names("
|
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: "
|
46
|
+
link_to(label, id(prefix: '#'), class: "#{brand}-tabs__tab")
|
47
47
|
end
|
48
48
|
|
49
49
|
def default_attributes
|
50
|
-
{ id: id, class:
|
50
|
+
{ id: id, class: "#{brand}-tabs__panel" }
|
51
51
|
end
|
52
52
|
|
53
53
|
def combined_attributes(i)
|
@@ -26,12 +26,12 @@ private
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def default_attributes
|
29
|
-
{ class: class_names("
|
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
|
-
|
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
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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
|
-
"
|
75
|
-
"
|
76
|
+
"#{brand}-table__#{class_suffix}",
|
77
|
+
"#{brand}-table__#{class_suffix}--numeric" => numeric?,
|
76
78
|
width => width?,
|
77
79
|
)
|
78
80
|
end
|
@@ -22,7 +22,7 @@ private
|
|
22
22
|
|
23
23
|
def default_attributes
|
24
24
|
{
|
25
|
-
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
|
-
|
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:
|
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:
|
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:
|
31
|
+
tag.span(icon_fallback_text, class: "#{brand}-warning-text__assistive")
|
32
32
|
end
|
33
33
|
|
34
34
|
def default_attributes
|
35
|
-
{ class:
|
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:
|
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 }
|