govuk-components 0.1.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.
Files changed (32) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +79 -0
  4. data/Rakefile +22 -0
  5. data/app/components/govuk_component/back_link.html.erb +1 -0
  6. data/app/components/govuk_component/back_link.rb +13 -0
  7. data/app/components/govuk_component/breadcrumbs.html.erb +15 -0
  8. data/app/components/govuk_component/breadcrumbs.rb +7 -0
  9. data/app/components/govuk_component/details.html.erb +10 -0
  10. data/app/components/govuk_component/details.rb +8 -0
  11. data/app/components/govuk_component/footer.html.erb +30 -0
  12. data/app/components/govuk_component/footer.rb +42 -0
  13. data/app/components/govuk_component/header.html.erb +25 -0
  14. data/app/components/govuk_component/header.rb +12 -0
  15. data/app/components/govuk_component/inset_text.rb +11 -0
  16. data/app/components/govuk_component/panel.html.erb +9 -0
  17. data/app/components/govuk_component/panel.rb +8 -0
  18. data/app/components/govuk_component/phase_banner.html.erb +10 -0
  19. data/app/components/govuk_component/phase_banner.rb +8 -0
  20. data/app/components/govuk_component/start_now_button.html.erb +6 -0
  21. data/app/components/govuk_component/start_now_button.rb +8 -0
  22. data/app/components/govuk_component/warning.html.erb +7 -0
  23. data/app/components/govuk_component/warning.rb +7 -0
  24. data/app/helpers/govuk_back_to_top_link_helper.rb +14 -0
  25. data/app/helpers/govuk_link_helper.rb +7 -0
  26. data/app/helpers/govuk_skip_link_helper.rb +6 -0
  27. data/config/routes.rb +2 -0
  28. data/lib/govuk/components.rb +2 -0
  29. data/lib/govuk/components/engine.rb +9 -0
  30. data/lib/govuk/components/version.rb +5 -0
  31. data/lib/tasks/govuk/components_tasks.rake +4 -0
  32. metadata +192 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 904a0b42cb6c48fa074a7335be5bd7194f90d155847fdb5b9cd5a8058cccaf49
4
+ data.tar.gz: 4c6dfb22f41539a2db530f1ea54ff4d811816bbb00839b7fbe9fe195b154e2d7
5
+ SHA512:
6
+ metadata.gz: fea5a83e8fc0e99321dd2d8db5181928fd35b701fe79d70a3c72e6337be8aaaacf6f294786939570e5ce08176ae471a5a847404e6818d43d9ba4230e37e18fff
7
+ data.tar.gz: 650e2c2606ceed00a0a5999020e5b30f2c8ee86cfcf1e82b2c579fabc9bed9a4eeea8b83e7d5a62af146aa572127b90c2dde04d3e5a7cbe5cc669ee297eb5930
@@ -0,0 +1,20 @@
1
+ Copyright 2020 Peter Yates
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,79 @@
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.
2
+
3
+ # GOV.UK Components
4
+
5
+ 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).
6
+
7
+ ## What's included
8
+
9
+ The gem will include the following components and helpers, [track their progress](https://github.com/DFE-Digital/govuk-components/issues/18):
10
+
11
+ ### Components
12
+
13
+ * Back link ✔️
14
+ * Breadcrumbs ✔️
15
+ * Details ✔️
16
+ * Footer ✔️
17
+ * Header ✔️
18
+ * Inset text ✔️
19
+ * Panel ✔️
20
+ * Phase banner ✔️
21
+ * Start now button ✔️
22
+ * Summary list
23
+ * Tag ✔️
24
+ * Warning text ✔️
25
+
26
+ ### Helpers
27
+
28
+ * `#govuk_link_to` ✔️
29
+ * `#govuk_mail_to`
30
+ * `#govuk_button_to`
31
+ * `#govuk_back_to_top_link` ✔️
32
+ * Skip link ✔️
33
+
34
+ ## Examples
35
+
36
+ For examples on usage see the [guide page](https://dfe-digital.github.io/govuk-components/).
37
+
38
+ ## Usage
39
+
40
+ Add this line to your `config/application.rb`:
41
+
42
+ ```ruby
43
+ require "govuk/components"
44
+ ```
45
+
46
+ ## Installation
47
+
48
+ Add this line to your application's Gemfile:
49
+
50
+ ```ruby
51
+ gem 'govuk-components'
52
+ ```
53
+
54
+ And then execute:
55
+ ```bash
56
+ $ bundle
57
+ ```
58
+
59
+ Or install it yourself as:
60
+ ```bash
61
+ $ gem install govuk-components
62
+ ```
63
+
64
+ ## Contributing
65
+
66
+ To setup the dummy app:
67
+
68
+ `cd spec/dummy`
69
+ `yarn install`
70
+ `bundle install`
71
+ `bin/rails db:create`
72
+ `bin/rails db:migrate`
73
+ `bin/rails s`
74
+
75
+ After adding a new component update the examples page by cd-ing into the dummy app `cd spec/dummy` and running the rake task `bin/rake generate_examples_page`.
76
+
77
+ ## License
78
+
79
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,22 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Govuk::Components'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+ load 'rails/tasks/statistics.rake'
21
+
22
+ require 'bundler/gem_tasks'
@@ -0,0 +1 @@
1
+ <%= link_to @text, @href, @options %>
@@ -0,0 +1,13 @@
1
+ class GovukComponent::BackLink < ViewComponent::Base
2
+ attr_accessor :text, :href, :options
3
+
4
+ def initialize(text:, href:, classes: nil, attributes: nil)
5
+ @text = text
6
+ @href = href
7
+ @classes = "govuk-back-link"
8
+ @classes << " #{classes}" if classes.present?
9
+
10
+ @options = { class: @classes }
11
+ @options.merge!(attributes) if attributes.present?
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ <ol class="govuk-breadcrumbs__list">
2
+ <%- @breadcrumbs.each do |text, link| %>
3
+
4
+ <%- if link.present? -%>
5
+ <li class="govuk-breadcrumbs__list-item">
6
+ <%= link_to(text, link, class: "govuk-breadcrumbs__link") %>
7
+ </li>
8
+ <% else %>
9
+ <li class="govuk-breadcrumbs__list-item" aria-current="page">
10
+ <%= text %>
11
+ </li>
12
+ <% end %>
13
+
14
+ <% end %>
15
+ </ol>
@@ -0,0 +1,7 @@
1
+ class GovukComponent::Breadcrumbs < ViewComponent::Base
2
+ attr_accessor :breadcrumbs
3
+
4
+ def initialize(breadcrumbs:)
5
+ @breadcrumbs = breadcrumbs
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ <details class="govuk-details" data-module="govuk-details">
2
+ <summary class="govuk-details__summary">
3
+ <span class="govuk-details__summary-text">
4
+ <%= @summary %>
5
+ </span>
6
+ </summary>
7
+ <div class="govuk-details__text">
8
+ <%= @text || content %>
9
+ </div>
10
+ </details>
@@ -0,0 +1,8 @@
1
+ class GovukComponent::Details < ViewComponent::Base
2
+ attr_accessor :summary, :text
3
+
4
+ def initialize(summary:, text: nil)
5
+ @summary = summary
6
+ @text = text
7
+ end
8
+ end
@@ -0,0 +1,30 @@
1
+ <footer class="govuk-footer " role="contentinfo">
2
+ <div class="govuk-width-container ">
3
+ <% if content.present? %>
4
+ <%= content %>
5
+ <% end %>
6
+ <div class="govuk-footer__meta">
7
+ <div class="govuk-footer__meta-item govuk-footer__meta-item--grow">
8
+ <% if @meta_links.any? %>
9
+ <%= @meta_heading %>
10
+ <ul class="govuk-footer__inline-list">
11
+ <% @meta_links.each do |meta_link| %>
12
+ <li class="govuk-footer__inline-list-item">
13
+ <%= meta_link %>
14
+ </li>
15
+ <% end %>
16
+ </ul>
17
+ <% end %>
18
+ <svg aria-hidden="true" focusable="false" class="govuk-footer__licence-logo" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 483.2 195.7" height="17" width="41">
19
+ <path fill="currentColor" d="M421.5 142.8V.1l-50.7 32.3v161.1h112.4v-50.7zm-122.3-9.6A47.12 47.12 0 0 1 221 97.8c0-26 21.1-47.1 47.1-47.1 16.7 0 31.4 8.7 39.7 21.8l42.7-27.2A97.63 97.63 0 0 0 268.1 0c-36.5 0-68.3 20.1-85.1 49.7A98 98 0 0 0 97.8 0C43.9 0 0 43.9 0 97.8s43.9 97.8 97.8 97.8c36.5 0 68.3-20.1 85.1-49.7a97.76 97.76 0 0 0 149.6 25.4l19.4 22.2h3v-87.8h-80l24.3 27.5zM97.8 145c-26 0-47.1-21.1-47.1-47.1s21.1-47.1 47.1-47.1 47.2 21 47.2 47S123.8 145 97.8 145" />
20
+ </svg>
21
+ <span class="govuk-footer__licence-description">
22
+ <%= @licence %>
23
+ </span>
24
+ </div>
25
+ <div class="govuk-footer__meta-item">
26
+ <%= @copyright %>
27
+ </div>
28
+ </div>
29
+ </div>
30
+ </footer>
@@ -0,0 +1,42 @@
1
+ class GovukComponent::Footer < ViewComponent::Base
2
+ attr_accessor :meta, :licence, :copyright
3
+
4
+ def initialize(meta_links: nil, meta_heading: default_meta_heading, licence: nil, copyright_text: default_copright_text, copyright_url: default_copyright_url)
5
+ @meta_links = build_meta_links(meta_links)
6
+ @meta_heading = raw(tag.h2(meta_heading, class: 'govuk-visually-hidden'))
7
+ @licence = licence || default_licence
8
+ @copyright = build_copyright(copyright_text, copyright_url)
9
+ end
10
+
11
+ private
12
+
13
+ def build_meta_links(links)
14
+ return [] if links.blank?
15
+
16
+ fail(ArgumentError, 'meta links must be a hash') unless links.is_a?(Hash)
17
+
18
+ links.map { |text, href| raw(link_to(text, href, class: %w(govuk-footer__link))) }
19
+ end
20
+
21
+ def default_meta_heading
22
+ 'Supporting links'
23
+ end
24
+
25
+ def default_licence
26
+ link = link_to("Open Government Licence v3.0", "https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/")
27
+
28
+ raw(%(All content is available under the #{link}, except where otherwise stated))
29
+ end
30
+
31
+ def build_copyright(text, url)
32
+ link_to(text, url, class: %w(govuk-footer__link govuk-footer__copyright-logo))
33
+ end
34
+
35
+ def default_copright_text
36
+ raw(%(&copy Crown copyright))
37
+ end
38
+
39
+ def default_copyright_url
40
+ "https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/"
41
+ end
42
+ end
@@ -0,0 +1,25 @@
1
+ <header class="govuk-header " role="banner" data-module="govuk-header">
2
+ <div class="govuk-header__container govuk-width-container">
3
+ <div class="govuk-header__logo">
4
+ <a href=<%= @logo_href %> class="govuk-header__link govuk-header__link--homepage">
5
+ <span class="govuk-header__logotype">
6
+ <svg aria-hidden="true" focusable="false" class="govuk-header__logotype-crown" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 132 97" height="30" width="36">
7
+ <path fill="currentColor" fill-rule="evenodd" d="M25 30.2c3.5 1.5 7.7-.2 9.1-3.7 1.5-3.6-.2-7.8-3.9-9.2-3.6-1.4-7.6.3-9.1 3.9-1.4 3.5.3 7.5 3.9 9zM9 39.5c3.6 1.5 7.8-.2 9.2-3.7 1.5-3.6-.2-7.8-3.9-9.1-3.6-1.5-7.6.2-9.1 3.8-1.4 3.5.3 7.5 3.8 9zM4.4 57.2c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.5-1.5-7.6.3-9.1 3.8-1.4 3.5.3 7.6 3.9 9.1zm38.3-21.4c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.6-1.5-7.6.3-9.1 3.8-1.3 3.6.4 7.7 3.9 9.1zm64.4-5.6c-3.6 1.5-7.8-.2-9.1-3.7-1.5-3.6.2-7.8 3.8-9.2 3.6-1.4 7.7.3 9.2 3.9 1.3 3.5-.4 7.5-3.9 9zm15.9 9.3c-3.6 1.5-7.7-.2-9.1-3.7-1.5-3.6.2-7.8 3.7-9.1 3.6-1.5 7.7.2 9.2 3.8 1.5 3.5-.3 7.5-3.8 9zm4.7 17.7c-3.6 1.5-7.8-.2-9.2-3.8-1.5-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.3 3.5-.4 7.6-3.9 9.1zM89.3 35.8c-3.6 1.5-7.8-.2-9.2-3.8-1.4-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.4 3.6-.3 7.7-3.9 9.1zM69.7 17.7l8.9 4.7V9.3l-8.9 2.8c-.2-.3-.5-.6-.9-.9L72.4 0H59.6l3.5 11.2c-.3.3-.6.5-.9.9l-8.8-2.8v13.1l8.8-4.7c.3.3.6.7.9.9l-5 15.4v.1c-.2.8-.4 1.6-.4 2.4 0 4.1 3.1 7.5 7 8.1h.2c.3 0 .7.1 1 .1.4 0 .7 0 1-.1h.2c4-.6 7.1-4.1 7.1-8.1 0-.8-.1-1.7-.4-2.4V34l-5.1-15.4c.4-.2.7-.6 1-.9zM66 92.8c16.9 0 32.8 1.1 47.1 3.2 4-16.9 8.9-26.7 14-33.5l-9.6-3.4c1 4.9 1.1 7.2 0 10.2-1.5-1.4-3-4.3-4.2-8.7L108.6 76c2.8-2 5-3.2 7.5-3.3-4.4 9.4-10 11.9-13.6 11.2-4.3-.8-6.3-4.6-5.6-7.9 1-4.7 5.7-5.9 8-.5 4.3-8.7-3-11.4-7.6-8.8 7.1-7.2 7.9-13.5 2.1-21.1-8 6.1-8.1 12.3-4.5 20.8-4.7-5.4-12.1-2.5-9.5 6.2 3.4-5.2 7.9-2 7.2 3.1-.6 4.3-6.4 7.8-13.5 7.2-10.3-.9-10.9-8-11.2-13.8 2.5-.5 7.1 1.8 11 7.3L80.2 60c-4.1 4.4-8 5.3-12.3 5.4 1.4-4.4 8-11.6 8-11.6H55.5s6.4 7.2 7.9 11.6c-4.2-.1-8-1-12.3-5.4l1.4 16.4c3.9-5.5 8.5-7.7 10.9-7.3-.3 5.8-.9 12.8-11.1 13.8-7.2.6-12.9-2.9-13.5-7.2-.7-5 3.8-8.3 7.1-3.1 2.7-8.7-4.6-11.6-9.4-6.2 3.7-8.5 3.6-14.7-4.6-20.8-5.8 7.6-5 13.9 2.2 21.1-4.7-2.6-11.9.1-7.7 8.8 2.3-5.5 7.1-4.2 8.1.5.7 3.3-1.3 7.1-5.7 7.9-3.5.7-9-1.8-13.5-11.2 2.5.1 4.7 1.3 7.5 3.3l-4.7-15.4c-1.2 4.4-2.7 7.2-4.3 8.7-1.1-3-.9-5.3 0-10.2l-9.5 3.4c5 6.9 9.9 16.7 14 33.5 14.8-2.1 30.8-3.2 47.7-3.2z"></path>
8
+ <image src="/assets/images/govuk-logotype-crown.png" xlink:href="" class="govuk-header__logotype-crown-fallback-image" width="36" height="32"></image>
9
+ </svg>
10
+ <span class="govuk-header__logotype-text">
11
+ <%= @logo %>
12
+ </span>
13
+ </span>
14
+ </a>
15
+ </div>
16
+ <div class="govuk-header__content">
17
+ <% if @service_name.present? %>
18
+ <a href="<%= @service_name_href %>" class="govuk-header__link govuk-header__link--service-name">
19
+ <%= @service_name %>
20
+ </a>
21
+ <% end %>
22
+ <%= nav %>
23
+ </div>
24
+ </div>
25
+ </header>
@@ -0,0 +1,12 @@
1
+ class GovukComponent::Header < ViewComponent::Base
2
+ attr_accessor :logo, :logo_href, :service_name, :service_name_href
3
+
4
+ with_content_areas :nav
5
+
6
+ def initialize(logo: 'GOV.UK', logo_href: '/', service_name: nil, service_name_href: '/')
7
+ @logo = logo
8
+ @logo_href = logo_href
9
+ @service_name = service_name
10
+ @service_name_href = service_name_href
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ class GovukComponent::InsetText < ViewComponent::Base
2
+ attr_accessor :text
3
+
4
+ def initialize(text:)
5
+ @text = text
6
+ end
7
+
8
+ def call
9
+ tag.div(class: 'govuk-inset-text') { @text }
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ <div class="govuk-panel govuk-panel--confirmation">
2
+ <h1 class="govuk-panel__title">
3
+ <%= @title %>
4
+ </h1>
5
+
6
+ <div class="govuk-panel__body">
7
+ <%= @body %>
8
+ </div>
9
+ </div>
@@ -0,0 +1,8 @@
1
+ class GovukComponent::Panel < ViewComponent::Base
2
+ attr_accessor :title, :body
3
+
4
+ def initialize(title:, body:)
5
+ @title = title
6
+ @body = body
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ <div class="govuk-phase-banner">
2
+ <p class="govuk-phase-banner__content">
3
+ <strong class="govuk-tag govuk-phase-banner__content__tag">
4
+ <%= @tag %>
5
+ </strong>
6
+ <span class="govuk-phase-banner__text">
7
+ <%= @text || content %>
8
+ </span>
9
+ </p>
10
+ </div>
@@ -0,0 +1,8 @@
1
+ class GovukComponent::PhaseBanner < ViewComponent::Base
2
+ attr_accessor :tag, :text
3
+
4
+ def initialize(tag:, text: nil)
5
+ @tag = tag
6
+ @text = text
7
+ end
8
+ end
@@ -0,0 +1,6 @@
1
+ <a href="<%= @href %>" role="button" draggable="false" class="govuk-button govuk-button--start" data-module="govuk-button">
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
+ </a>
@@ -0,0 +1,8 @@
1
+ class GovukComponent::StartNowButton < ViewComponent::Base
2
+ attr_accessor :text, :href
3
+
4
+ def initialize(text:, href:)
5
+ @text = text
6
+ @href = href
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ <div class="govuk-warning-text <%= @classes.join(' ') %>">
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
+ </div>
@@ -0,0 +1,7 @@
1
+ class GovukComponent::Warning < ViewComponent::Base
2
+ def initialize(text:, icon_fallback_text: 'Warning', classes: [])
3
+ @text = text
4
+ @icon_fallback_text = icon_fallback_text
5
+ @classes = Array.wrap(classes)
6
+ end
7
+ end
@@ -0,0 +1,14 @@
1
+ module GovukBackToTopLinkHelper
2
+ def govuk_back_to_top_link
3
+ link_to '#top', class: 'govuk-link govuk-link--no-visited-state' do
4
+ <<-HTML.squish.html_safe
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
+ <path fill="currentColor" d="M6.5 0L0 6.5 1.4 8l4-4v12.7h2V4l4.3 4L13 6.4z"></path>
7
+ </svg>
8
+ Back to top
9
+ HTML
10
+ end
11
+ end
12
+ end
13
+
14
+ ActiveSupport.on_load(:action_view) { include GovukBackToTopLinkHelper }
@@ -0,0 +1,7 @@
1
+ module GovukLinkHelper
2
+ def govuk_link_to(*args, **kwargs)
3
+ link_to(*args, **{ class: 'govuk-link' }.deep_merge(kwargs))
4
+ end
5
+ end
6
+
7
+ ActiveSupport.on_load(:action_view) { include GovukLinkHelper }
@@ -0,0 +1,6 @@
1
+ module GovukSkipLinkHelper
2
+ def govuk_skip_link(text: 'Skip to main content', href: '#main-content')
3
+ link_to text, href, class: 'govuk-skip-link'
4
+ end
5
+ end
6
+ ActiveSupport.on_load(:action_view) { include GovukSkipLinkHelper }
@@ -0,0 +1,2 @@
1
+ Govuk::Components::Engine.routes.draw do
2
+ end
@@ -0,0 +1,2 @@
1
+ require "view_component/engine"
2
+ require "govuk/components/engine"
@@ -0,0 +1,9 @@
1
+ module Govuk
2
+ module Components
3
+ class Engine < ::Rails::Engine
4
+ isolate_namespace Govuk::Components
5
+ end
6
+ end
7
+ end
8
+
9
+ Dir[Govuk::Components::Engine.root.join(*%w(app helpers *.rb))].each { |f| require f }
@@ -0,0 +1,5 @@
1
+ module Govuk
2
+ module Components
3
+ VERSION = '0.1.0'
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :govuk_components do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,192 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: govuk-components
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - DfE developers
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-06-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 6.0.2
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 6.0.2.2
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: 6.0.2
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 6.0.2.2
33
+ - !ruby/object:Gem::Dependency
34
+ name: slim-rails
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '3.2'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '3.2'
47
+ - !ruby/object:Gem::Dependency
48
+ name: view_component
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '2.5'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '2.5'
61
+ - !ruby/object:Gem::Dependency
62
+ name: sqlite3
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: capybara
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rspec-rails
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ - !ruby/object:Gem::Dependency
104
+ name: pry-byebug
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ - !ruby/object:Gem::Dependency
118
+ name: sassc-rails
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ description: A collection of components intended to ease the building of GOV.UK Design
132
+ System web applications
133
+ email:
134
+ - peter.yates@digital.education.gov.uk
135
+ executables: []
136
+ extensions: []
137
+ extra_rdoc_files: []
138
+ files:
139
+ - MIT-LICENSE
140
+ - README.md
141
+ - Rakefile
142
+ - app/components/govuk_component/back_link.html.erb
143
+ - app/components/govuk_component/back_link.rb
144
+ - app/components/govuk_component/breadcrumbs.html.erb
145
+ - app/components/govuk_component/breadcrumbs.rb
146
+ - app/components/govuk_component/details.html.erb
147
+ - app/components/govuk_component/details.rb
148
+ - app/components/govuk_component/footer.html.erb
149
+ - app/components/govuk_component/footer.rb
150
+ - app/components/govuk_component/header.html.erb
151
+ - app/components/govuk_component/header.rb
152
+ - app/components/govuk_component/inset_text.rb
153
+ - app/components/govuk_component/panel.html.erb
154
+ - app/components/govuk_component/panel.rb
155
+ - app/components/govuk_component/phase_banner.html.erb
156
+ - app/components/govuk_component/phase_banner.rb
157
+ - app/components/govuk_component/start_now_button.html.erb
158
+ - app/components/govuk_component/start_now_button.rb
159
+ - app/components/govuk_component/warning.html.erb
160
+ - app/components/govuk_component/warning.rb
161
+ - app/helpers/govuk_back_to_top_link_helper.rb
162
+ - app/helpers/govuk_link_helper.rb
163
+ - app/helpers/govuk_skip_link_helper.rb
164
+ - config/routes.rb
165
+ - lib/govuk/components.rb
166
+ - lib/govuk/components/engine.rb
167
+ - lib/govuk/components/version.rb
168
+ - lib/tasks/govuk/components_tasks.rake
169
+ homepage: https://www.github.com/dfe-digital
170
+ licenses:
171
+ - MIT
172
+ metadata: {}
173
+ post_install_message:
174
+ rdoc_options: []
175
+ require_paths:
176
+ - lib
177
+ required_ruby_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ required_rubygems_version: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ requirements: []
188
+ rubygems_version: 3.0.3
189
+ signing_key:
190
+ specification_version: 4
191
+ summary: Lightweight set of reusable GOV.UK Design System components
192
+ test_files: []