govuk-components 2.0.0rc3 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39ac79b41b17e5f17f5f6b80e195595ae1396f5d83a3a14c14564412831fdbc8
|
4
|
+
data.tar.gz: 587e0b9a9688c4c239e1e8cbdf44111c88aa82cd1014197293b308d0b2409f36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
[![
|
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
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
*
|
36
|
-
*
|
37
|
-
*
|
38
|
-
|
39
|
-
|
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 `
|
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
|
-
<%=
|
47
|
-
|
48
|
-
<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
|
-
|
51
|
-
|
72
|
+
|
73
|
+
<% component.tab(label: 'Tuesday') do %>
|
74
|
+
<p>Tuesday's child is full of grace</p>
|
52
75
|
<% end %>
|
53
|
-
|
54
|
-
|
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
|
84
|
+
Here are the rendered tabs:
|
60
85
|
|
61
|
-
![
|
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
|
-
|
19
|
-
|
20
|
-
tag.div(class: "govuk-grid-column-two-thirds") { safe_join([heading_element, message_element]) }
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|
40
|
+
heading_html || heading_text
|
39
41
|
end
|
40
42
|
|
41
43
|
def message_element
|
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.
|
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-
|
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:
|
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: []
|