govuk-components 1.1.8 → 2.0.0b3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/app/components/govuk_component/{accordion.html.erb → accordion_component.html.erb} +2 -2
- data/app/components/govuk_component/{accordion.rb → accordion_component.rb} +7 -6
- data/app/components/govuk_component/{back_link.rb → back_link_component.rb} +5 -1
- data/app/components/govuk_component/base.rb +9 -7
- data/app/components/govuk_component/{breadcrumbs.html.erb → breadcrumbs_component.html.erb} +3 -6
- data/app/components/govuk_component/{breadcrumbs.rb → breadcrumbs_component.rb} +1 -1
- data/app/components/govuk_component/{cookie_banner.html.erb → cookie_banner_component.html.erb} +2 -6
- data/app/components/govuk_component/{cookie_banner.rb → cookie_banner_component.rb} +3 -2
- data/app/components/govuk_component/details_component.rb +34 -0
- data/app/components/govuk_component/{footer.html.erb → footer_component.html.erb} +3 -5
- data/app/components/govuk_component/{footer.rb → footer_component.rb} +3 -8
- data/app/components/govuk_component/header_component.html.erb +49 -0
- data/app/components/govuk_component/header_component.rb +110 -0
- data/app/components/govuk_component/{inset_text.rb → inset_text_component.rb} +3 -3
- data/app/components/govuk_component/notification_banner_component.html.erb +14 -0
- data/app/components/govuk_component/{notification_banner.rb → notification_banner_component.rb} +28 -14
- data/app/components/govuk_component/panel_component.rb +46 -0
- data/app/components/govuk_component/phase_banner_component.html.erb +6 -0
- data/app/components/govuk_component/phase_banner_component.rb +20 -0
- data/app/components/govuk_component/start_button_component.rb +47 -0
- data/app/components/govuk_component/summary_list_component.html.erb +11 -0
- data/app/components/govuk_component/summary_list_component.rb +61 -0
- data/app/components/govuk_component/tab_component.html.erb +11 -0
- data/app/components/govuk_component/{tabs.rb → tab_component.rb} +23 -12
- data/app/components/govuk_component/{tag.rb → tag_component.rb} +21 -3
- data/app/components/govuk_component/warning_text_component.rb +38 -0
- data/app/helpers/govuk_components_helper.rb +16 -16
- data/lib/govuk/components.rb +1 -0
- data/lib/govuk/components/helpers/css_utilities.rb +22 -0
- data/lib/govuk/components/version.rb +1 -1
- metadata +52 -42
- data/app/components/govuk_component/back_link.html.erb +0 -1
- data/app/components/govuk_component/details.html.erb +0 -10
- data/app/components/govuk_component/details.rb +0 -16
- data/app/components/govuk_component/header.html.erb +0 -52
- data/app/components/govuk_component/header.rb +0 -65
- data/app/components/govuk_component/notification_banner.html.erb +0 -23
- data/app/components/govuk_component/panel.html.erb +0 -13
- data/app/components/govuk_component/panel.rb +0 -28
- data/app/components/govuk_component/phase_banner.html.erb +0 -8
- data/app/components/govuk_component/phase_banner.rb +0 -16
- data/app/components/govuk_component/start_now_button.html.erb +0 -6
- data/app/components/govuk_component/start_now_button.rb +0 -16
- data/app/components/govuk_component/summary_list.html.erb +0 -19
- data/app/components/govuk_component/summary_list.rb +0 -34
- data/app/components/govuk_component/tabs.html.erb +0 -19
- data/app/components/govuk_component/warning.html.erb +0 -7
- data/app/components/govuk_component/warning.rb +0 -14
@@ -1,6 +0,0 @@
|
|
1
|
-
<%= link_to(@href, role: 'button', draggable: 'false', class: classes, data: { module: 'govuk-button' }, **html_attributes) do %>
|
2
|
-
<%= @text %>
|
3
|
-
<svg class="govuk-button__start-icon" xmlns="http://www.w3.org/2000/svg" width="17.5" height="19" viewBox="0 0 33 40" aria-hidden="true" focusable="false">
|
4
|
-
<path fill="currentColor" d="M0 0h13l20 20-20 20H0l20-20z" />
|
5
|
-
</svg>
|
6
|
-
<% end %>
|
@@ -1,16 +0,0 @@
|
|
1
|
-
class GovukComponent::StartNowButton < GovukComponent::Base
|
2
|
-
attr_accessor :text, :href
|
3
|
-
|
4
|
-
def initialize(text:, href:, classes: [], html_attributes: {})
|
5
|
-
super(classes: classes, html_attributes: html_attributes)
|
6
|
-
|
7
|
-
@text = text
|
8
|
-
@href = href
|
9
|
-
end
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def default_classes
|
14
|
-
%w(govuk-button govuk-button--start)
|
15
|
-
end
|
16
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
<%= tag.dl(class: classes, **html_attributes) do %>
|
2
|
-
<% rows.each do |row| %>
|
3
|
-
<%= tag.div(class: row.classes, **row.html_attributes) do %>
|
4
|
-
<dt class="govuk-summary-list__key">
|
5
|
-
<%= row.key %>
|
6
|
-
</dt>
|
7
|
-
|
8
|
-
<dd class="govuk-summary-list__value">
|
9
|
-
<%= row.value %>
|
10
|
-
</dd>
|
11
|
-
|
12
|
-
<% if any_row_has_actions? %>
|
13
|
-
<dd class="govuk-summary-list__actions">
|
14
|
-
<%= row.action %>
|
15
|
-
</dd>
|
16
|
-
<% end %>
|
17
|
-
<% end %>
|
18
|
-
<% end %>
|
19
|
-
<% end %>
|
@@ -1,34 +0,0 @@
|
|
1
|
-
class GovukComponent::SummaryList < GovukComponent::Base
|
2
|
-
include ViewComponent::Slotable
|
3
|
-
|
4
|
-
with_slot :row, collection: true, class_name: 'Row'
|
5
|
-
wrap_slot :row
|
6
|
-
|
7
|
-
def any_row_has_actions?
|
8
|
-
rows.any? { |r| r.action.present? }
|
9
|
-
end
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def default_classes
|
14
|
-
%w(govuk-summary-list)
|
15
|
-
end
|
16
|
-
|
17
|
-
class Row < GovukComponent::Slot
|
18
|
-
attr_accessor :key, :value, :action
|
19
|
-
|
20
|
-
def initialize(key:, value:, action: nil, classes: [], html_attributes: {})
|
21
|
-
super(classes: classes, html_attributes: html_attributes)
|
22
|
-
|
23
|
-
self.key = key
|
24
|
-
self.value = value
|
25
|
-
self.action = action
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
def default_classes
|
31
|
-
%w(govuk-summary-list__row)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
<%= tag.div(class: classes, data: { module: 'govuk-tabs' }, **html_attributes) do %>
|
2
|
-
<h2 class="govuk-tabs__title">
|
3
|
-
<%= title %>
|
4
|
-
</h2>
|
5
|
-
<ul class="govuk-tabs__list">
|
6
|
-
<% tabs.each.with_index do |tab, i| %>
|
7
|
-
<li class="govuk-tabs__list-item <%= 'govuk-tabs__list-item--selected' if i.zero? %>">
|
8
|
-
<a class="govuk-tabs__tab" href="<%= tab.id(prefix: '#') %>">
|
9
|
-
<%= tab.title %>
|
10
|
-
</a>
|
11
|
-
</li>
|
12
|
-
<% end %>
|
13
|
-
</ul>
|
14
|
-
<% tabs.each.with_index do |tab, i| %>
|
15
|
-
<%= tag.div(class: tab.classes.append(tab.hidden_class(i)), id: tab.id, **tab.html_attributes) do %>
|
16
|
-
<%= tab.content %>
|
17
|
-
<% end %>
|
18
|
-
<% end %>
|
19
|
-
<% end %>
|
@@ -1,7 +0,0 @@
|
|
1
|
-
<%= content_tag('div', class: classes, **html_attributes) do %>
|
2
|
-
<span class="govuk-warning-text__icon" aria-hidden="true">!</span>
|
3
|
-
<strong class="govuk-warning-text__text">
|
4
|
-
<span class="govuk-warning-text__assistive"><%= @icon_fallback_text %></span>
|
5
|
-
<%= @text %>
|
6
|
-
</strong>
|
7
|
-
<% end %>
|
@@ -1,14 +0,0 @@
|
|
1
|
-
class GovukComponent::Warning < GovukComponent::Base
|
2
|
-
def initialize(text:, icon_fallback_text: 'Warning', classes: [], html_attributes: {})
|
3
|
-
super(classes: classes, html_attributes: html_attributes)
|
4
|
-
|
5
|
-
@text = text
|
6
|
-
@icon_fallback_text = icon_fallback_text
|
7
|
-
end
|
8
|
-
|
9
|
-
private
|
10
|
-
|
11
|
-
def default_classes
|
12
|
-
%w(govuk-warning-text)
|
13
|
-
end
|
14
|
-
end
|