govuk_publishing_components 21.47.0 → 21.48.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: a88b34716fb241b208992a85a5554ad8b041729523c3a10c7274818b00d0c936
4
- data.tar.gz: 7a0d928fdd91e5bec26a068e81086a9e5667076dfd554b458cae25cb3266b97d
3
+ metadata.gz: 41bce645d4da9c9c6fd2b1ab5e91fb4ecea8d1b76060fde43f56141fa3101570
4
+ data.tar.gz: 3ae1030faab5c0cd05487dda793de110743831147d5fe145c9cc69b8d92231b5
5
5
  SHA512:
6
- metadata.gz: 8b66ecac6dc60e0f92c6518c49beb6e52ea3fc242ee59122c746a392547aab37fd26ff0cc83b2fbeea78fb4f0ef540f413d04a92f91493117c7b6f48326dd150
7
- data.tar.gz: 935b0628237148bab2337d69336a48617014dd9e164e2678cf70003005b29899c7c535b15b2171704c7f3b3375018b97ccfc487c56dba9f582157407d718a8a5
6
+ metadata.gz: 2402cf261528736c5326f7687e70af627469ce970dd74800825a2a0cd7f3fdb97a0a4b56178a331579733ca98a3ee03987fafd192159f1ece14c29a4a9848076
7
+ data.tar.gz: a84744cc1ae7d7805aab08a6144b277f3e304ef23ad40b05396f47ed68fe04ebf103b9f51234cb223e9e3ecbf5215d7aa58d9ef86748a701f13cd44b8e1d9cc9
@@ -71,10 +71,10 @@
71
71
  &:before {
72
72
  content: "";
73
73
  position: absolute;
74
- top: 0;
74
+ top: 10%;
75
75
  left: govuk-spacing(2);
76
76
  width: govuk-spacing(2);
77
- height: 100%;
77
+ height: 80%;
78
78
  border-left: solid 1px $govuk-text-colour;
79
79
  }
80
80
  }
@@ -10,17 +10,22 @@
10
10
  simple ||= false
11
11
  dark_icon ||= false
12
12
  data ||= nil
13
+ classes ||= nil
14
+
13
15
  css_classes = %w(gem-c-action-link)
14
16
  css_classes << "gem-c-action-link--light-text" if light_text
15
17
  css_classes << "gem-c-action-link--dark-icon" if dark_icon
16
18
  css_classes << "gem-c-action-link--simple" if simple
17
19
  css_classes << "gem-c-action-link--with-subtext" if subtext
18
20
  css_classes << (shared_helper.get_margin_bottom)
21
+
22
+ link_classes = %w(govuk-link gem-c-action-link__link)
23
+ link_classes << shared_helper.classes if classes
19
24
  %>
20
25
  <% if href.present? && text.present? %>
21
26
  <div class="<%= css_classes.join(' ') %>">
22
27
  <span class="gem-c-action-link__link-wrapper">
23
- <%= link_to href, :class => "govuk-link gem-c-action-link__link", :data => data do %>
28
+ <%= link_to href, :class => link_classes, :data => data do %>
24
29
  <%= text %>
25
30
  <%= content_tag(:span, nowrap_text, class: "gem-c-action-link__nowrap-text") if nowrap_text %>
26
31
  <% end %>
@@ -1,4 +1,8 @@
1
- <% button = GovukPublishingComponents::Presenters::ButtonHelper.new(local_assigns) %>
1
+ <%
2
+ shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
3
+ local_assigns[:classes] = shared_helper.classes
4
+ button = GovukPublishingComponents::Presenters::ButtonHelper.new(local_assigns)
5
+ %>
2
6
 
3
7
  <% start_button_text = capture do %>
4
8
  <%= button.text %>
@@ -18,6 +18,12 @@ examples:
18
18
  href: '/my-test-page'
19
19
  data:
20
20
  attr_test: "hasDataAttribute"
21
+ with_js_classes:
22
+ description: Use `js-` prefixed classes only as interaction hooks – to query and operate on elements via JavaScript. Classes are added to the link itself.
23
+ data:
24
+ text: "Coronavirus (COVID-19)"
25
+ href: '/my-test-page'
26
+ classes: 'js-hook'
21
27
  with_no_wrapping_text:
22
28
  data:
23
29
  text: "Coronavirus (COVID-19):"
@@ -44,12 +44,7 @@ module GovukPublishingComponents
44
44
  @destructive = local_assigns[:destructive]
45
45
  @name = local_assigns[:name]
46
46
  @value = local_assigns[:value]
47
- if local_assigns.include?(:classes)
48
- @classes = local_assigns[:classes].split(" ")
49
- unless @classes.all? { |c| c.start_with?("js-") }
50
- raise(ArgumentError, "The button component expects classes to be prefixed with `js-`")
51
- end
52
- end
47
+ @classes = local_assigns[:classes]
53
48
  @aria_label = local_assigns[:aria_label]
54
49
  end
55
50
 
@@ -1,13 +1,20 @@
1
1
  module GovukPublishingComponents
2
2
  module Presenters
3
3
  class SharedHelper
4
- attr_reader :options, :margin_top, :margin_bottom, :heading_level
4
+ attr_reader :options, :margin_top, :margin_bottom, :heading_level, :classes
5
5
 
6
6
  def initialize(local_assigns)
7
7
  @options = local_assigns
8
8
  @margin_top = @options[:margin_top] || nil
9
9
  @margin_bottom = @options[:margin_bottom] || 3
10
10
  @heading_level = @options[:heading_level] || 2
11
+
12
+ if local_assigns.include?(:classes)
13
+ @classes = local_assigns[:classes].split(" ")
14
+ unless @classes.all? { |c| c.start_with?("js-") }
15
+ raise(ArgumentError, "Passed classes must be prefixed with `js-`")
16
+ end
17
+ end
11
18
  end
12
19
 
13
20
  def get_margin_top
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "21.47.0".freeze
2
+ VERSION = "21.48.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 21.47.0
4
+ version: 21.48.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-19 00:00:00.000000000 Z
11
+ date: 2020-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gds-api-adapters