govuk-components 0.3.0 → 0.4.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: 1d957c212c5a58ad13e5e6296200d65d1d5571ede1ad3a466a2d799bd33cab59
4
- data.tar.gz: 4bb34fa91578e1d5fa59f7a0f80fb1d363c0dbeb87979328c64c35d83ca0c471
3
+ metadata.gz: ca6bbedcd46abb76a978275beaf7952aa821078902f8c431dd3feebceeb48de2
4
+ data.tar.gz: f6e16eadbada45dcd58e87b7b299aeafcef1466dddadff36ce966b410dc708c8
5
5
  SHA512:
6
- metadata.gz: '080f8799ba56540bd4ecd4d7e038f1c413a6c12955bf10a87ba547d4cd120196a0e2a95ad1a4f75e8177cf467044d39a7dc4641c280480c1bef691c036818f26'
7
- data.tar.gz: 61957c3b0aeb5fcca7a420445ad5ecc3013d5a42b054c291898d276505322e5cc057efd7d92c860dad20da2f3f0cd4360586bba06939f62f4ad6b1f2b9f6cf82
6
+ metadata.gz: 83f92b4bc426ed547e001d0b014e6b43742336f3ec8cd9f5feccf9b88b9bdf38718dcc10046727aab3f1b8e2c435615a22eb76baef1cccb5b4a53bf088ec2aaf
7
+ data.tar.gz: 874f9ad8b165be4816e53b03a1e0f513a1c8672635fcdc81c44c7e9cc71095caa1090b9550b74fa995276eaf2faeeb567137808640cdb9475938c7afb90af446
data/README.md CHANGED
@@ -1,45 +1,63 @@
1
- > **Note!** This repository is very new and not yet fully built and documented. Breaking changes can happen at any time. Please check the [components tracker](https://github.com/DFE-Digital/govuk-components/issues/18) to see progress.
1
+ **This gem is under heavy development and the API is likely to change.**
2
2
 
3
3
  # GOV.UK Components
4
4
 
5
5
  [![Build Status](https://travis-ci.com/DFE-Digital/govuk-components.svg?branch=master)](https://travis-ci.com/DFE-Digital/govuk-components)
6
6
 
7
- 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. ViewComponent is [supported natively in Rails 6.1](https://edgeguides.rubyonrails.org/layouts_and_rendering.html#rendering-objects).
7
+ 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. ViewComponent will be [supported natively in Rails 6.1](https://edgeguides.rubyonrails.org/layouts_and_rendering.html#rendering-objects).
8
8
 
9
9
  ## What's included
10
10
 
11
- The gem will include the following components and helpers, [track their progress](https://github.com/DFE-Digital/govuk-components/issues/18):
12
-
13
- ### Components
14
-
15
- * Accordion ✔️
16
- * Back link ✔️
17
- * Breadcrumbs ✔️
18
- * Details ✔️
19
- * Footer ✔️
20
- * Header ✔️
21
- * Inset text ✔️
22
- * Panel ✔️
23
- * Phase banner ✔️
24
- * Start now button ✔️
25
- * Summary list ✔️
26
- * Tabs ✔️
27
- * Tag ✔️
28
- * Warning text ✔️
11
+ | Component name | Helper |
12
+ | -------------- | ------ |
13
+ | [Accordion](app/components/govuk_component/accordion.rb) | `govuk_accordion` |
14
+ | [Back link](app/components/govuk_component/back_link.rb) | `govuk_back_link` |
15
+ | [Breadcrumbs](app/components/govuk_component/breadcrumbs.rb) | `govuk_breadcrumbs` |
16
+ | [Details](app/components/govuk_component/details.rb) | `govuk_details` |
17
+ | [Footer](app/components/govuk_component/footer.rb) | `govuk_footer` |
18
+ | [Header](app/components/govuk_component/header.rb) | `govuk_header` |
19
+ | [Inset text](app/components/govuk_component/inset_text.rb) | `govuk_inset_text` |
20
+ | [Panel](app/components/govuk_component/panel.rb) | `govuk_panel` |
21
+ | [Phase banner](app/components/govuk_component/phase_banner.rb) | `govuk_phase_banner` |
22
+ | [Start now button](app/components/govuk_component/start_now_button.rb) | `govuk_start_now_button` |
23
+ | [Summary list](app/components/govuk_component/summary_list.rb) | `govuk_summary_list` |
24
+ | [Tabs](app/components/govuk_component/tabs.rb) | `govuk_tabs` |
25
+ | [Tag](app/components/govuk_component/tag.rb) | `govuk_tag` |
26
+ | [Warning text](app/components/govuk_component/warning.rb) | `govuk_warning` |
29
27
 
30
28
  ### Helpers
31
29
 
32
- * `#govuk_link_to` ✔️
33
- * `#govuk_mail_to` ✔️
34
- * `#govuk_button_to` ✔️
35
- * `#govuk_back_to_top_link` ✔️
36
- * Skip link ✔️
30
+ * `#govuk_link_to`
31
+ * `#govuk_mail_to`
32
+ * `#govuk_button_to`
33
+ * `#govuk_back_to_top_link`
34
+ * `#govuk_skip_link`
35
+
36
+ ## Example use
37
+
38
+ 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.
39
+
40
+ ```erb
41
+ <%= govuk_accordion(id: 'def234') do |accordion| %>
42
+ <%= accordion.add_section(title: 'Section 1') do %>
43
+ <p class="govuk-body">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
44
+ <% end %>
45
+ <%= accordion.add_section(title: 'Section 2') do %>
46
+ <p class="govuk-body">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
47
+ <% end %>
48
+ <%= accordion.add_section(title: 'Section 3') do %>
49
+ <p class="govuk-body">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
50
+ <% end %>
51
+ <% end %>
52
+ ```
53
+
54
+ Here is the rendered accordion.
37
55
 
38
- ## Examples
56
+ ![Accordion preview](docs/images/accordion.png)
39
57
 
40
58
  For examples on usage see the [guide page](https://dfe-digital.github.io/govuk-components/).
41
59
 
42
- ## Usage
60
+ ## Setup
43
61
 
44
62
  Add this line to your `config/application.rb`:
45
63
 
@@ -7,10 +7,10 @@ class GovukComponent::Base < ViewComponent::Base
7
7
  @html_attributes = html_attributes
8
8
  end
9
9
 
10
- # Redirect #name to #slot(:name) to make building components
10
+ # Redirect #add_name to #slot(:name) to make building components
11
11
  # with slots feel more DSL-like
12
12
  def self.wrap_slot(name)
13
- define_method(name) do |*args, **kwargs, &block|
13
+ define_method(%(add_#{name})) do |*args, **kwargs, &block|
14
14
  self.slot(name, *args, **kwargs, &block)
15
15
  end
16
16
  end
@@ -1,5 +1,5 @@
1
1
  module Govuk
2
2
  module Components
3
- VERSION = '0.3.0'
3
+ VERSION = '0.4.0'
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: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - DfE developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-16 00:00:00.000000000 Z
11
+ date: 2020-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails