govuk_publishing_components 23.6.0 → 23.7.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: 34b79bd902906ae48c22d4f01510b329d279a953d607ef7633fcd29d44dbd3ef
4
- data.tar.gz: e4bf0609433d8308708a96da4b9a6e9f2960e3551960af806c12be5bb74be16d
3
+ metadata.gz: 4a97fad3ed17572d72aa4904dec96a13f48732b2c740f017dd8ac3a8c9ef9d93
4
+ data.tar.gz: 429048afab20b2b89b342024d4681ccccfb4c7706d1e09051cfdf6c47af1066d
5
5
  SHA512:
6
- metadata.gz: 285ae326a806521d45584efced7930c995009d6577820a248fec57fb4f0974d7e2eeaaabd7ba2e245beac066fe16e1c398a2ffc6590141e272fb1c2807adbf96
7
- data.tar.gz: c2e148283ce68ef51963f2b9a437aa754bb65f5baa9aadc712316605e3028c3d0714d1db6f36214f77be558755464d013bb63ede138764376076376cb484de76
6
+ metadata.gz: f51d92a980b602c69168a506866f2a496c4ea85558de991083ba09a3c7c054a50486dd8169bcb74f61ffa279066bbbf0e6d2a367c6d457f1f89ede11fff78423
7
+ data.tar.gz: d32c3132330f198be910b85ca88fdbf96c061a5fb5e2520eedd741ff03ea1af0072823e45d654ade08a84ae8a9ac9aedfbea80bc1a41156dda99d987a6fbd638
@@ -73,4 +73,5 @@
73
73
  @import "components/textarea";
74
74
  @import "components/title";
75
75
  @import "components/translation-nav";
76
+ @import "components/transition-countdown";
76
77
  @import "components/warning-text";
@@ -1,3 +1,5 @@
1
+ @import 'transition-countdown';
2
+
1
3
  .gem-c-contextual-sidebar__brexit-cta {
2
4
  border-top: 2px solid $govuk-brand-colour;
3
5
  }
@@ -0,0 +1,125 @@
1
+ $transition-campaign-red: #ff003b;
2
+ $transition-campaign-dark-blue: #1e1348;
3
+
4
+ .gem-c-transition-countdown {
5
+ @include govuk-font(19);
6
+ margin-bottom: govuk-spacing(6);
7
+ }
8
+
9
+ .gem-c-transition-countdown--cta {
10
+ background-color: govuk-colour('light-grey', $legacy: 'grey-4');
11
+ border-top: 4px solid $transition-campaign-red;
12
+ display: block;
13
+ padding: govuk-spacing(3);
14
+ text-decoration: none;
15
+ }
16
+
17
+ .gem-c-transition-countdown__title {
18
+ @extend %govuk-heading-m;
19
+ color: $transition-campaign-dark-blue;
20
+ }
21
+
22
+ .gem-c-transition-countdown__countdown {
23
+ margin-top: 0;
24
+ margin-bottom: govuk-spacing(2);
25
+
26
+ @include govuk-media-query($from: tablet) {
27
+ margin-bottom: govuk-spacing(0);
28
+ }
29
+ }
30
+
31
+ .gem-c-transition-countdown__countdown-number {
32
+ @include govuk-font($size: 80, $weight: bold, $line-height: 60px);
33
+
34
+ min-width: 50px;
35
+ text-align: center;
36
+ display: inline-block;
37
+ background: $transition-campaign-dark-blue;
38
+ color: govuk-colour('white');
39
+ position: relative;
40
+ margin-bottom: govuk-spacing(2);
41
+
42
+ @include govuk-media-query($from: tablet) {
43
+ padding: govuk-spacing(2) govuk-spacing(1);
44
+ }
45
+
46
+ &:after {
47
+ position: absolute;
48
+ left: 0;
49
+ top: 50%;
50
+ margin-top: -1px;
51
+ height: 3px;
52
+ background: govuk-colour('white');
53
+ content: '';
54
+ width: 100%;
55
+ display: block;
56
+ }
57
+
58
+ &:first-child {
59
+ margin-right: 3px;
60
+ }
61
+
62
+ &:nth-child(2) {
63
+ margin-right: govuk-spacing(2);
64
+ }
65
+ }
66
+
67
+ .gem-c-transition-countdown__countdown-text {
68
+ @extend %govuk-heading-m;
69
+
70
+ display: inline-block;
71
+ margin-bottom: 0;
72
+ height: 45px;
73
+ vertical-align: middle;
74
+ color: $transition-campaign-dark-blue;
75
+
76
+ @include govuk-media-query($from: tablet) {
77
+ height: 80px;
78
+ }
79
+
80
+ &:after {
81
+ content: '' / '.'; // Wrap up the countdown-text element in a statement for screen readers
82
+ }
83
+ }
84
+
85
+ .gem-c-transition-countdown__text {
86
+ @extend %govuk-link;
87
+
88
+ margin-top: 0;
89
+ margin-bottom: 0;
90
+ text-decoration: underline;
91
+
92
+ @include govuk-media-query($from: tablet) {
93
+ margin-bottom: govuk-spacing(2);
94
+ }
95
+ }
96
+
97
+ .gem-c-transition-countdown:focus {
98
+ .gem-c-transition-countdown__countdown-number:after {
99
+ background-color: $govuk-focus-colour;
100
+ }
101
+
102
+ .gem-c-transition-countdown__text {
103
+ text-decoration: none;
104
+ }
105
+ }
106
+
107
+ @include govuk-compatibility(govuk_template) {
108
+ .gem-c-transition-countdown__title {
109
+ margin-bottom: govuk-spacing(3);
110
+ }
111
+
112
+ .gem-c-transition-countdown__countdown-number {
113
+ padding: govuk-spacing(1) 0 0;
114
+
115
+ @include govuk-media-query($from: tablet) {
116
+ padding: govuk-spacing(3) govuk-spacing(1) govuk-spacing(1);
117
+ }
118
+ }
119
+
120
+ .gem-c-transition-countdown__countdown-text {
121
+ @include govuk-media-query($from: tablet) {
122
+ height: 75px;
123
+ }
124
+ }
125
+ }
@@ -1,8 +1,21 @@
1
1
  <% navigation = GovukPublishingComponents::Presenters::ContextualNavigation.new(content_item, request) %>
2
2
 
3
3
  <div class="gem-c-contextual-sidebar">
4
- <% if navigation.show_brexit_cta? && navigation.step_by_step_count.eql?(0) %>
4
+ <% if navigation.show_brexit_cta? && navigation.step_by_step_count.zero? %>
5
5
  <%= render 'govuk_publishing_components/components/contextual_sidebar/brexit_cta' %>
6
+ <% elsif navigation.step_by_step_count.zero? %>
7
+ <%= render 'govuk_publishing_components/components/transition_countdown', {
8
+ title: t("components.related_navigation.transition.title"),
9
+ url: t("components.related_navigation.transition.link_path"),
10
+ text: t("components.related_navigation.transition.link_text"),
11
+ data_attributes: {
12
+ "track-category": "relatedLinkClicked",
13
+ "track-action": "1.0 Transition",
14
+ "track-label": t("components.related_navigation.transition.link_path"),
15
+ "track-options": "{'dimension29':'#{t("components.related_navigation.transition.link_text")}'}"
16
+ },
17
+ lang: I18n.locale,
18
+ } %>
6
19
  <% end %>
7
20
 
8
21
  <% if navigation.content_tagged_to_a_reasonable_number_of_step_by_steps? %>
@@ -0,0 +1,34 @@
1
+ <%
2
+ countdown_clock = GovukPublishingComponents::AppHelpers::CountdownHelper.new
3
+ shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
4
+
5
+ heading_level ||= 2
6
+ title ||= nil
7
+ text ||= nil
8
+ url ||= nil
9
+ data_attributes ||= {}
10
+ lang ||= 'en'
11
+ css_classes = %w(gem-c-transition-countdown)
12
+ css_classes << 'gem-c-transition-countdown--cta' if url
13
+ css_classes << 'govuk-link' if url
14
+ %>
15
+
16
+ <% countdown = capture do %>
17
+ <%= content_tag(shared_helper.get_heading_level, title, class: "gem-c-transition-countdown__title") if title %>
18
+ <% if countdown_clock.show? %>
19
+ <%= tag.p class: "gem-c-transition-countdown__countdown" do %>
20
+ <%= tag.span countdown_clock.days_left.first, class: "gem-c-transition-countdown__countdown-number" %><%= tag.span countdown_clock.days_left.last, class: "gem-c-transition-countdown__countdown-number" %> <%= tag.span countdown_clock.days_text, class: "gem-c-transition-countdown__countdown-text" %>
21
+ <% end %>
22
+ <% end %>
23
+ <%= tag.p text, class: "gem-c-transition-countdown__text" if text %>
24
+ <% end %>
25
+
26
+ <% if url %>
27
+ <%= link_to url, class: css_classes, data: data_attributes, lang: lang do %>
28
+ <%= countdown %>
29
+ <% end %>
30
+ <% else %>
31
+ <%= tag.div class: css_classes, lang: lang do %>
32
+ <%= countdown %>
33
+ <% end %>
34
+ <% end %>
@@ -144,4 +144,3 @@ examples:
144
144
  - text: Find out what you’ll get
145
145
  href: "/settled-status-eu-citizens-families/what-settled-and-presettled-status-means"
146
146
  optional: false
147
-
@@ -0,0 +1,17 @@
1
+ name: Transition countdown
2
+ description: A countdown to 01 January 2021 used in the Brexit transition campaign
3
+ body: When a URL is set it acts as a link to actions users need to take to prepare for brexit during the transition period
4
+ shared_accessibility_criteria:
5
+ - link
6
+ examples:
7
+ default:
8
+ data:
9
+ call_to_action:
10
+ data:
11
+ title: Brexit transition
12
+ text: Check you’re ready for 2021
13
+ url: "https://www.gov.uk/transition"
14
+ data_attributes:
15
+ "track-category": "Transition"
16
+ "track-action": "Brexit transition"
17
+ "track-label": "Check you’re ready for 2021"
@@ -10,4 +10,9 @@ cy:
10
10
  contents: Cynnwys
11
11
  related_navigation:
12
12
  transition:
13
+ title: "Pontio Brexit"
13
14
  link_path: "/transition.cy"
15
+ link_text: "Gwiriwch eich bod chi'n barod ar gyfer 2021"
16
+ transition_countdown:
17
+ day_to_go: "diwrnod i fynd"
18
+ days_to_go: "diwrnod i fynd"
@@ -74,7 +74,7 @@ en:
74
74
  transition:
75
75
  title: "Brexit transition"
76
76
  link_path: "/transition"
77
- link_text: "Find out what it means for you"
77
+ link_text: "Check you’re ready for 2021"
78
78
  related_footer_navigation:
79
79
  collections: "Collections"
80
80
  policies: "Policies"
@@ -98,3 +98,6 @@ en:
98
98
  summary_list:
99
99
  edit: "Change"
100
100
  delete: "Delete"
101
+ transition_countdown:
102
+ day_to_go: "day to go"
103
+ days_to_go: "days to go"
@@ -34,6 +34,7 @@ require "govuk_publishing_components/presenters/taxonomy_list_helper"
34
34
  require "govuk_publishing_components/app_helpers/taxon_breadcrumbs"
35
35
  require "govuk_publishing_components/app_helpers/table_helper"
36
36
  require "govuk_publishing_components/app_helpers/brand_helper"
37
+ require "govuk_publishing_components/app_helpers/countdown_helper"
37
38
  require "govuk_publishing_components/app_helpers/environment"
38
39
 
39
40
  # Add view and i18n paths for usage outside of a Rails app
@@ -0,0 +1,33 @@
1
+ module GovukPublishingComponents
2
+ module AppHelpers
3
+ class CountdownHelper
4
+ END_OF_TRANSITION_PERIOD = Date.new(2021, 1, 1)
5
+
6
+ def days_left
7
+ sprintf "%02d", days_left_integer
8
+ end
9
+
10
+ def show?
11
+ days_left_integer.positive?
12
+ end
13
+
14
+ def days_text
15
+ if days_left_integer == 1
16
+ I18n.t!("components.transition_countdown.day_to_go")
17
+ else
18
+ I18n.t!("components.transition_countdown.days_to_go")
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ def days_left_integer
25
+ (END_OF_TRANSITION_PERIOD - today_in_london).to_i
26
+ end
27
+
28
+ def today_in_london
29
+ Time.find_zone("Europe/London").today
30
+ end
31
+ end
32
+ end
33
+ end
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "23.6.0".freeze
2
+ VERSION = "23.7.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: 23.6.0
4
+ version: 23.7.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-11-17 00:00:00.000000000 Z
11
+ date: 2020-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -522,6 +522,7 @@ files:
522
522
  - app/assets/stylesheets/govuk_publishing_components/components/_taxonomy-list.scss
523
523
  - app/assets/stylesheets/govuk_publishing_components/components/_textarea.scss
524
524
  - app/assets/stylesheets/govuk_publishing_components/components/_title.scss
525
+ - app/assets/stylesheets/govuk_publishing_components/components/_transition-countdown.scss
525
526
  - app/assets/stylesheets/govuk_publishing_components/components/_translation-nav.scss
526
527
  - app/assets/stylesheets/govuk_publishing_components/components/_warning-text.scss
527
528
  - app/assets/stylesheets/govuk_publishing_components/components/govspeak/_advisory.scss
@@ -673,6 +674,7 @@ files:
673
674
  - app/views/govuk_publishing_components/components/_taxonomy_list.html.erb
674
675
  - app/views/govuk_publishing_components/components/_textarea.html.erb
675
676
  - app/views/govuk_publishing_components/components/_title.html.erb
677
+ - app/views/govuk_publishing_components/components/_transition_countdown.html.erb
676
678
  - app/views/govuk_publishing_components/components/_translation-nav.html.erb
677
679
  - app/views/govuk_publishing_components/components/_warning_text.html.erb
678
680
  - app/views/govuk_publishing_components/components/attachment/_thumbnail_document.svg
@@ -751,6 +753,7 @@ files:
751
753
  - app/views/govuk_publishing_components/components/docs/taxonomy_list.yml
752
754
  - app/views/govuk_publishing_components/components/docs/textarea.yml
753
755
  - app/views/govuk_publishing_components/components/docs/title.yml
756
+ - app/views/govuk_publishing_components/components/docs/transition_countdown.yml
754
757
  - app/views/govuk_publishing_components/components/docs/translation-nav.yml
755
758
  - app/views/govuk_publishing_components/components/docs/warning_text.yml
756
759
  - app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb
@@ -775,6 +778,7 @@ files:
775
778
  - lib/generators/govuk_publishing_components/templates/component.yml.erb
776
779
  - lib/govuk_publishing_components.rb
777
780
  - lib/govuk_publishing_components/app_helpers/brand_helper.rb
781
+ - lib/govuk_publishing_components/app_helpers/countdown_helper.rb
778
782
  - lib/govuk_publishing_components/app_helpers/environment.rb
779
783
  - lib/govuk_publishing_components/app_helpers/table_helper.rb
780
784
  - lib/govuk_publishing_components/app_helpers/taxon_breadcrumbs.rb