govuk-components 1.1.9 → 1.2.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: 58f95bba6b6806470b1963b8e9d62aa69eb0b09c98c0d6ec0e8416ac9412d14e
4
- data.tar.gz: 053dab8628ad0849dd16c01649c6cef559b277612f0766d25061e691bcc574b5
3
+ metadata.gz: 6f842d29dfabae4169ed1b2105df65c7f951e53001c3b8850f0f45c1f80f581c
4
+ data.tar.gz: '048b188612f81942b978fac451b4777f8076f6e459275f84b6eab70effa2f9df'
5
5
  SHA512:
6
- metadata.gz: 21f9795a2058a029949d179df03227f05c10cf7d41c2e0645566aff872886ec2c5293b1d91c7472a61c9496fad12174d15f2985568b06427942261db4912084d
7
- data.tar.gz: 883d695f40a82e58ed96fd1ee78a9426fe62e5772cf10a182165f31fc6781b8ecccdd606388ee5725aad9f02077e2940f969c05271766ab9cf7e64b46aa79254
6
+ metadata.gz: 52fc5f481b7daf4472a3b25a98d588b4195071063b3c2283e7c6da75ec818ac4561bd41f1e33689d96bf4e98415c8bb7f3f836e4303075ca9af1a9020377ce97
7
+ data.tar.gz: 2c3ad6f877a3466a0407567c0eaa3c181f37ea3b657dd79633ec7b1fde020bf4d9b9aa9212943d190620e26ff80723726f0b50ffb6c6a7c60f7812dbd1c33edb
data/README.md CHANGED
@@ -99,7 +99,11 @@ To setup the dummy app:
99
99
  `bin/rails db:migrate`
100
100
  `bin/rails s`
101
101
 
102
- 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`.
102
+ After changing a component or adding a new one:
103
+
104
+ * add or update the corresponding specs, and check they pass by running `bundle exec rspec`.
105
+
106
+ * update the examples page by cd-ing into the dummy app `cd spec/dummy` and running the rake task `bin/rake generate_examples_page`.
103
107
 
104
108
  ## License
105
109
 
@@ -3,7 +3,7 @@
3
3
  <%= tag.div(id: section.id(suffix: 'section'), class: section.classes, **section.html_attributes) do %>
4
4
  <div class="govuk-accordion__section-header">
5
5
  <h2 class="govuk-accordion__section-heading">
6
- <%= tag.span(section.title, id: section.id, class: "govuk-accordion__section-button", aria: { expanded: section.expanded? }) %>
6
+ <%= tag.span(section.title, id: section.id, class: "govuk-accordion__section-button", aria: { expanded: section.expanded?, controls: section.id(suffix: 'content') }) %>
7
7
  </h2>
8
8
  <% if section.summary.present? %>
9
9
  <%= tag.div(section.summary, id: section.id(suffix: 'summary'), class: %w(govuk-accordion__section-summary govuk-body)) %>
@@ -30,11 +30,9 @@
30
30
  <% end %>
31
31
 
32
32
  <% if items.any? %>
33
- <button type="button" class="govuk-header__menu-button govuk-js-header-toggle" aria-controls="navigation" aria-label="Show or hide navigation menu">
34
- <%= menu_button_label %>
35
- </button>
33
+ <button type="button" class="govuk-header__menu-button govuk-js-header-toggle" aria-controls="navigation" aria-label="<%= menu_button_label %>">Menu</button>
36
34
  <nav>
37
- <%= tag.ul(class: navigation_classes, aria: { label: "Top Level Navigation" }) do %>
35
+ <%= tag.ul(class: navigation_classes, id: "navigation", aria: { label: navigation_label }) do %>
38
36
  <% items.each do |item| %>
39
37
  <%= tag.li(class: item.classes.append(item.active_class), **item.html_attributes) do %>
40
38
  <% if item.link? %>
@@ -1,7 +1,7 @@
1
1
  class GovukComponent::Header < GovukComponent::Base
2
2
  include ViewComponent::Slotable
3
3
 
4
- attr_accessor :logo, :logo_href, :service_name, :service_name_href, :product_name, :menu_button_label
4
+ attr_accessor :logo, :logo_href, :service_name, :service_name_href, :product_name, :menu_button_label, :navigation_label
5
5
 
6
6
  with_slot :item, collection: true, class_name: 'Item'
7
7
  wrap_slot :item
@@ -9,7 +9,7 @@ class GovukComponent::Header < GovukComponent::Base
9
9
  with_slot :product_description
10
10
  wrap_slot :product_description
11
11
 
12
- def initialize(logo: 'GOV.UK', logo_href: '/', service_name: nil, service_name_href: '/', product_name: nil, menu_button_label: 'Menu', classes: [], navigation_classes: [], html_attributes: {})
12
+ def initialize(logo: 'GOV.UK', logo_href: '/', service_name: nil, service_name_href: '/', product_name: nil, menu_button_label: 'Show or hide navigation menu', classes: [], navigation_classes: [], navigation_label: 'Navigation menu', html_attributes: {})
13
13
  super(classes: classes, html_attributes: html_attributes)
14
14
 
15
15
  @logo = logo
@@ -19,6 +19,7 @@ class GovukComponent::Header < GovukComponent::Base
19
19
  @product_name = product_name
20
20
  @menu_button_label = menu_button_label
21
21
  @navigation_classes = navigation_classes
22
+ @navigation_label = navigation_label
22
23
  end
23
24
 
24
25
  private
@@ -1,5 +1,5 @@
1
1
  module Govuk
2
2
  module Components
3
- VERSION = '1.1.9'.freeze
3
+ VERSION = '1.2.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: 1.1.9
4
+ version: 1.2.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: 2021-04-28 00:00:00.000000000 Z
11
+ date: 2021-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties