govuk-components 2.0.0rc3 → 2.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: beb46263535565ddbe53ab329c2a0065a9bba711014a59cc17906ae90be6d606
4
- data.tar.gz: ba8a6b1c46e1fd4ccc5b987a9f3603982067c60e5f0be47b896da24d41fe40a4
3
+ metadata.gz: 39ac79b41b17e5f17f5f6b80e195595ae1396f5d83a3a14c14564412831fdbc8
4
+ data.tar.gz: 587e0b9a9688c4c239e1e8cbdf44111c88aa82cd1014197293b308d0b2409f36
5
5
  SHA512:
6
- metadata.gz: 05a8518a55e542bfc68d08dd6cff014e186c865523de16b51fe7f20d656faeda8ad75d50f2eaffc4bab6fb4482aaa22c0382de5ef8a5b41c5c85c6408e03462f
7
- data.tar.gz: db2e57dc051165386d32e5800d2dc28a146999b2cb215f3b806be62b07b4a2f96878ea8261c614f853dbf0d0d0b6be461b995b4febff6aabece1d4771e978a7a
6
+ metadata.gz: 826c5c80a39daefff656c96139c8f3c0ad6ceaffa7c8000a482f5b35a085b0f3251c7ded964c5bff0bc7a977287f77ed4ca2f5e4684d73e279d589de946e97a3
7
+ data.tar.gz: cb1e686cf23ef788c4d45544bd1c4cc97cdb91a560a9ca7653d71b299dedfc735721b67b7d22062823f21283f56889e43e6a3b8e35eac29d8395cf9b1dfc169c
data/README.md CHANGED
@@ -4,61 +4,86 @@
4
4
  [![Maintainability](https://api.codeclimate.com/v1/badges/cbcbc140f300b920d833/maintainability)](https://codeclimate.com/github/DFE-Digital/govuk-components/maintainability)
5
5
  [![Test Coverage](https://api.codeclimate.com/v1/badges/cbcbc140f300b920d833/test_coverage)](https://codeclimate.com/github/DFE-Digital/govuk-components/test_coverage)
6
6
  [![GitHub license](https://img.shields.io/github/license/DFE-Digital/govuk-components)](https://github.com/DFE-Digital/govuk-components/blob/master/LICENSE)
7
- [![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=DFE-Digital/govuk-components)](https://dependabot.com)
8
- [![GOV.UK Design System Version](https://img.shields.io/badge/GOV.UK%20Design%20System-3.10.2-brightgreen)](https://design-system.service.gov.uk)
7
+ [![GOV.UK Design System Version](https://img.shields.io/badge/GOV.UK%20Design%20System-3.13.0-brightgreen)](https://design-system.service.gov.uk)
9
8
 
10
9
  This gem provides a suite of reusable components for the [GOV.UK Design System](https://design-system.service.gov.uk/). It is intended to provide a lightweight alternative to the [GOV.UK Publishing Components](https://github.com/alphagov/govuk_publishing_components) library and is built with Github's [ViewComponent](https://github.com/github/view_component) framework.
11
10
 
12
- ## What's included
13
-
14
- | Component name | Helper |
15
- | -------------- | ------ |
16
- | [Accordion](app/components/govuk_component/accordion.rb) | `govuk_accordion` |
17
- | [Back link](app/components/govuk_component/back_link.rb) | `govuk_back_link` |
18
- | [Breadcrumbs](app/components/govuk_component/breadcrumbs.rb) | `govuk_breadcrumbs` |
19
- | [Cookie banner](app/components/govuk_component/cookie_banner.rb) | `govuk_cookie_banner` |
20
- | [Details](app/components/govuk_component/details.rb) | `govuk_details` |
21
- | [Footer](app/components/govuk_component/footer.rb) | `govuk_footer` |
22
- | [Header](app/components/govuk_component/header.rb) | `govuk_header` |
23
- | [Inset text](app/components/govuk_component/inset_text.rb) | `govuk_inset_text` |
24
- | [Notification banner](app/components/govuk_component/notification_banner.rb) | `govuk_notification_banner` |
25
- | [Panel](app/components/govuk_component/panel.rb) | `govuk_panel` |
26
- | [Phase banner](app/components/govuk_component/phase_banner.rb) | `govuk_phase_banner` |
27
- | [Start now button](app/components/govuk_component/start_now_button.rb) | `govuk_start_now_button` |
28
- | [Summary list](app/components/govuk_component/summary_list.rb) | `govuk_summary_list` |
29
- | [Tabs](app/components/govuk_component/tabs.rb) | `govuk_tabs` |
30
- | [Tag](app/components/govuk_component/tag.rb) | `govuk_tag` |
31
- | [Warning text](app/components/govuk_component/warning.rb) | `govuk_warning` |
32
-
33
- ### Helpers
34
-
35
- * `#govuk_link_to`
36
- * `#govuk_mail_to`
37
- * `#govuk_button_to`
38
- * `#govuk_back_to_top_link`
39
- * `#govuk_skip_link`
11
+ It aims to implement the functionality from the original Nunjucks macros in a way that will feel more familiar to Rails developers. Blocks are preferred over strings of HTML, beneath the surface each component is just a Ruby object, everything is inheritable and overrideable.
12
+
13
+ ## What's included?
14
+
15
+ All of the non-form components from the GOV.UK Design System are implmented by this library as ViewComponents. Form components are implemented by the [form builder](https://govuk-form-builder.netlify.app/).
16
+
17
+ The provided components are:
18
+
19
+ * [Accordion](https://dfe-digital.github.io/govuk-components/#accordion)
20
+ * [Back link](https://dfe-digital.github.io/govuk-components/#back-links)
21
+ * [Back to top link](https://dfe-digital.github.io/govuk-components/#back-to-top-link)
22
+ * [Breadcrumbs](https://dfe-digital.github.io/govuk-components/#breadcrumbs)
23
+ * [Cookie banner](https://dfe-digital.github.io/govuk-components/#cookie-banner)
24
+ * [Details](https://dfe-digital.github.io/govuk-components/#details)
25
+ * [Footer](https://dfe-digital.github.io/govuk-components/#footer)
26
+ * [Header](https://dfe-digital.github.io/govuk-components/#header)
27
+ * [Inset text](https://dfe-digital.github.io/govuk-components/#inset-text)
28
+ * [Notification banner](https://dfe-digital.github.io/govuk-components/#notification-banner)
29
+ * [Panel](https://dfe-digital.github.io/govuk-components/#panel)
30
+ * [Phase banner](https://dfe-digital.github.io/govuk-components/#phase-banner)
31
+ * [Skip link](https://dfe-digital.github.io/govuk-components/#skip-link)
32
+ * [Start button](https://dfe-digital.github.io/govuk-components/#start-button)
33
+ * [Summary list](https://dfe-digital.github.io/govuk-components/#summary-list)
34
+ * [Tabs](https://dfe-digital.github.io/govuk-components/#tabs)
35
+ * [Tags](https://dfe-digital.github.io/govuk-components/#tags)
36
+ * [Warning text](https://dfe-digital.github.io/govuk-components/#warning-text)
37
+
38
+ This library also provides [several link helpers](https://dfe-digital.github.io/govuk-components/#links-and-buttons) that are commonly used in services, including `#govuk_link_to` and `#govuk_button_to`.
39
+
40
+ ## Alternative syntax
41
+
42
+ All of the components can be rendered in two ways:
43
+
44
+ * directly using Rails' `#render` method:
45
+
46
+ ```erb
47
+ <%= render GovukComponent::GovukComponent::WarningTextComponent.new do %>
48
+ A serious warning
49
+ <% end %>
50
+ ```
51
+
52
+ * via the helper wrapper:
53
+
54
+ ```erb
55
+ <%= govuk_warning_text do %>
56
+ A serious warning
57
+ <% end %>
58
+ ```
59
+
60
+ The naming convention for helpers is `govuk_` followed by the component's name in snake case. You can
61
+ see the full list in [GovukComponentsHelper](app/helpers/govuk_components_helper.rb).
40
62
 
41
63
  ## Example use
42
64
 
43
- This library allows components to be rendered with Rails' `render` method or via the provided helpers. Here we'll use the `govuk_accordion` to render an accordion.
65
+ This library allows components to be rendered with Rails' `render` method or via the provided helpers. Here we'll use the `govuk_tabs` to render three tabbed sections:
44
66
 
45
67
  ```erb
46
- <%= govuk_accordion(id: 'def234') do |accordion| %>
47
- <%= accordion.add_section(title: 'Section 1') do %>
48
- <p class="govuk-body">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
68
+ <%= govuk_tabs(title: 'Days of the week') do |component| %>
69
+ <% component.tab(label: 'Monday') do %>
70
+ <p>Monday's child is fair of face</p>
49
71
  <% end %>
50
- <%= accordion.add_section(title: 'Section 2') do %>
51
- <p class="govuk-body">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
72
+
73
+ <% component.tab(label: 'Tuesday') do %>
74
+ <p>Tuesday's child is full of grace</p>
52
75
  <% end %>
53
- <%= accordion.add_section(title: 'Section 3') do %>
54
- <p class="govuk-body">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
76
+
77
+ <% component.tab(label: 'Wednesday') do %>
78
+ <p>Wednesday's child is full of woe</p>
55
79
  <% end %>
56
80
  <% end %>
81
+
57
82
  ```
58
83
 
59
- Here is the rendered accordion.
84
+ Here are the rendered tabs:
60
85
 
61
- ![Accordion preview](docs/images/accordion.png)
86
+ ![Tabs preview](docs/images/tabs.png)
62
87
 
63
88
  For examples on usage see the [guide page](https://dfe-digital.github.io/govuk-components/).
64
89
 
@@ -70,6 +95,15 @@ Add this line to your `config/application.rb`:
70
95
  require "govuk/components"
71
96
  ```
72
97
 
98
+ ## Services using this library
99
+
100
+ * [Apply for teacher training](https://github.com/DFE-Digital/apply-for-teacher-training)
101
+ * [Find postgraduate teacher training](https://github.com/DFE-Digital/find-teacher-training)
102
+ * [Get help with technology](https://github.com/DFE-Digital/get-help-with-tech)
103
+ * [Publish teacher training courses](https://github.com/DFE-Digital/publish-teacher-training)
104
+ * [Register trainee teachers](https://github.com/DFE-Digital/register-trainee-teachers)
105
+ * [Teaching Vacancies](https://github.com/DFE-Digital/teaching-vacancies)
106
+
73
107
  ## Installation
74
108
 
75
109
  Add this line to your application's Gemfile:
@@ -15,12 +15,12 @@ class GovukComponent::CookieBannerComponent::MessageComponent < GovukComponent::
15
15
 
16
16
  def call
17
17
  tag.div(class: classes, role: role, hidden: hidden, **html_attributes) do
18
- tag.div(class: "govuk-grid-row") do
19
- safe_join([
20
- tag.div(class: "govuk-grid-column-two-thirds") { safe_join([heading_element, message_element]) },
21
- actions_element
22
- ])
23
- end
18
+ safe_join([
19
+ tag.div(class: "govuk-grid-row") do
20
+ tag.div(class: "govuk-grid-column-two-thirds") { safe_join([heading_element, message_element]) }
21
+ end,
22
+ actions_element
23
+ ])
24
24
  end
25
25
  end
26
26
 
@@ -31,11 +31,13 @@ private
31
31
  end
32
32
 
33
33
  def heading_element
34
+ return if heading_content.blank?
35
+
34
36
  tag.h2(heading_content, class: %w(govuk-cookie-banner__heading govuk-heading-m))
35
37
  end
36
38
 
37
39
  def heading_content
38
- heading_html || heading_text || fail(ArgumentError, "no heading_text or heading_html")
40
+ heading_html || heading_text
39
41
  end
40
42
 
41
43
  def message_element
@@ -1,5 +1,5 @@
1
1
  module Govuk
2
2
  module Components
3
- VERSION = '2.0.0rc3'.freeze
3
+ VERSION = '2.0.0'.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.0.0rc3
4
+ version: 2.0.0
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-08-06 00:00:00.000000000 Z
11
+ date: 2021-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -209,7 +209,7 @@ homepage: https://github.com/DFE-Digital/govuk-components
209
209
  licenses:
210
210
  - MIT
211
211
  metadata: {}
212
- post_install_message:
212
+ post_install_message:
213
213
  rdoc_options: []
214
214
  require_paths:
215
215
  - lib
@@ -220,12 +220,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
220
220
  version: '0'
221
221
  required_rubygems_version: !ruby/object:Gem::Requirement
222
222
  requirements:
223
- - - ">"
223
+ - - ">="
224
224
  - !ruby/object:Gem::Version
225
- version: 1.3.1
225
+ version: '0'
226
226
  requirements: []
227
227
  rubygems_version: 3.1.6
228
- signing_key:
228
+ signing_key:
229
229
  specification_version: 4
230
230
  summary: Lightweight set of reusable GOV.UK Design System components
231
231
  test_files: []