govuk_publishing_components 34.0.0 → 34.5.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 (145) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/govuk_publishing_components/icon-search.svg +3 -0
  3. data/app/assets/images/govuk_publishing_components/youtube-play-icon.png +0 -0
  4. data/app/assets/images/govuk_publishing_components/youtube-play-icon.svg +4 -0
  5. data/app/assets/javascripts/govuk_publishing_components/analytics/auto-scroll-tracker.js +2 -1
  6. data/app/assets/javascripts/govuk_publishing_components/analytics/linked-domains.js +135 -0
  7. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-core.js +1 -40
  8. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-event-tracker.js +2 -0
  9. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-page-views.js +4 -4
  10. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4.js +0 -1
  11. data/app/assets/javascripts/govuk_publishing_components/components/cookie-banner.js +2 -2
  12. data/app/assets/javascripts/govuk_publishing_components/components/image-card.js +19 -0
  13. data/app/assets/javascripts/govuk_publishing_components/components/layout-super-navigation-header.js +12 -69
  14. data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +14 -13
  15. data/app/assets/javascripts/govuk_publishing_components/dependencies.js +3 -0
  16. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js +3 -2
  17. data/app/assets/javascripts/govuk_publishing_components/load-analytics.js +209 -0
  18. data/app/assets/javascripts/govuk_publishing_components/modules.js +7 -2
  19. data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +15 -19
  20. data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +82 -1
  21. data/app/assets/stylesheets/govuk_publishing_components/components/_input.scss +1 -1
  22. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +247 -412
  23. data/app/assets/stylesheets/govuk_publishing_components/components/_subscription-links.scss +0 -1
  24. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_steps.scss +26 -9
  25. data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_brand-colours.scss +2 -2
  26. data/app/controllers/govuk_publishing_components/application_controller.rb +0 -13
  27. data/app/controllers/govuk_publishing_components/audit_controller.rb +1 -1
  28. data/app/models/govuk_publishing_components/audit_comparer.rb +1 -1
  29. data/app/models/govuk_publishing_components/audit_components.rb +103 -82
  30. data/app/views/govuk_publishing_components/audit/_applications.html.erb +1 -1
  31. data/app/views/govuk_publishing_components/audit/_component_contents.html.erb +47 -39
  32. data/app/views/govuk_publishing_components/audit/_components.html.erb +1 -1
  33. data/app/views/govuk_publishing_components/components/_accordion.html.erb +2 -2
  34. data/app/views/govuk_publishing_components/components/_contextual_footer.html.erb +2 -0
  35. data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +7 -3
  36. data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +10 -6
  37. data/app/views/govuk_publishing_components/components/_error_message.html.erb +2 -1
  38. data/app/views/govuk_publishing_components/components/_google_tag_manager_script.html.erb +2 -2
  39. data/app/views/govuk_publishing_components/components/_hint.html.erb +2 -1
  40. data/app/views/govuk_publishing_components/components/_image_card.html.erb +12 -9
  41. data/app/views/govuk_publishing_components/components/_input.html.erb +8 -2
  42. data/app/views/govuk_publishing_components/components/_label.html.erb +5 -3
  43. data/app/views/govuk_publishing_components/components/_layout_for_admin.html.erb +2 -2
  44. data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +6 -2
  45. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +125 -145
  46. data/app/views/govuk_publishing_components/components/_related_navigation.html.erb +12 -6
  47. data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +1 -1
  48. data/app/views/govuk_publishing_components/components/_textarea.html.erb +10 -2
  49. data/app/views/govuk_publishing_components/components/docs/contextual_footer.yml +43 -0
  50. data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +58 -0
  51. data/app/views/govuk_publishing_components/components/docs/emergency_banner.yml +3 -1
  52. data/app/views/govuk_publishing_components/components/docs/error_message.yml +13 -0
  53. data/app/views/govuk_publishing_components/components/docs/hint.yml +6 -0
  54. data/app/views/govuk_publishing_components/components/docs/image_card.yml +24 -1
  55. data/app/views/govuk_publishing_components/components/docs/input.yml +32 -0
  56. data/app/views/govuk_publishing_components/components/docs/intervention.yml +2 -1
  57. data/app/views/govuk_publishing_components/components/docs/label.yml +17 -0
  58. data/app/views/govuk_publishing_components/components/docs/layout_header.yml +1 -0
  59. data/app/views/govuk_publishing_components/components/docs/previous_and_next_navigation.yml +2 -0
  60. data/app/views/govuk_publishing_components/components/docs/related_navigation.yml +27 -0
  61. data/app/views/govuk_publishing_components/components/docs/textarea.yml +31 -0
  62. data/app/views/govuk_publishing_components/components/docs/translation_nav.yml +2 -0
  63. data/app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb +2 -2
  64. data/app/views/govuk_publishing_components/components/feedback/_yes_no_banner.html.erb +1 -2
  65. data/app/views/govuk_publishing_components/components/metadata/_sentence.html.erb +4 -2
  66. data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +18 -8
  67. data/app/views/layouts/govuk_publishing_components/application.html.erb +2 -2
  68. data/config/locales/ar.yml +14 -7
  69. data/config/locales/az.yml +14 -7
  70. data/config/locales/be.yml +14 -7
  71. data/config/locales/bg.yml +14 -7
  72. data/config/locales/bn.yml +14 -7
  73. data/config/locales/cs.yml +14 -7
  74. data/config/locales/cy.yml +14 -7
  75. data/config/locales/da.yml +14 -7
  76. data/config/locales/de.yml +14 -7
  77. data/config/locales/dr.yml +14 -7
  78. data/config/locales/el.yml +14 -7
  79. data/config/locales/en.yml +18 -18
  80. data/config/locales/es-419.yml +14 -7
  81. data/config/locales/es.yml +14 -7
  82. data/config/locales/et.yml +14 -7
  83. data/config/locales/fa.yml +14 -7
  84. data/config/locales/fi.yml +14 -7
  85. data/config/locales/fr.yml +14 -7
  86. data/config/locales/gd.yml +14 -7
  87. data/config/locales/gu.yml +14 -7
  88. data/config/locales/he.yml +14 -7
  89. data/config/locales/hi.yml +14 -7
  90. data/config/locales/hr.yml +14 -7
  91. data/config/locales/hu.yml +14 -7
  92. data/config/locales/hy.yml +14 -7
  93. data/config/locales/id.yml +14 -7
  94. data/config/locales/is.yml +14 -7
  95. data/config/locales/it.yml +14 -7
  96. data/config/locales/ja.yml +14 -7
  97. data/config/locales/ka.yml +14 -7
  98. data/config/locales/kk.yml +14 -7
  99. data/config/locales/ko.yml +14 -7
  100. data/config/locales/lt.yml +14 -7
  101. data/config/locales/lv.yml +14 -7
  102. data/config/locales/ms.yml +14 -7
  103. data/config/locales/mt.yml +14 -7
  104. data/config/locales/nl.yml +14 -7
  105. data/config/locales/no.yml +14 -7
  106. data/config/locales/pa-pk.yml +14 -7
  107. data/config/locales/pa.yml +14 -7
  108. data/config/locales/pl.yml +14 -7
  109. data/config/locales/ps.yml +14 -7
  110. data/config/locales/pt.yml +14 -7
  111. data/config/locales/ro.yml +14 -7
  112. data/config/locales/ru.yml +14 -7
  113. data/config/locales/si.yml +14 -7
  114. data/config/locales/sk.yml +14 -7
  115. data/config/locales/sl.yml +14 -7
  116. data/config/locales/so.yml +14 -7
  117. data/config/locales/sq.yml +14 -7
  118. data/config/locales/sr.yml +14 -7
  119. data/config/locales/sv.yml +14 -7
  120. data/config/locales/sw.yml +14 -7
  121. data/config/locales/ta.yml +14 -7
  122. data/config/locales/th.yml +14 -7
  123. data/config/locales/tk.yml +14 -7
  124. data/config/locales/tr.yml +14 -7
  125. data/config/locales/uk.yml +14 -7
  126. data/config/locales/ur.yml +14 -7
  127. data/config/locales/uz.yml +14 -7
  128. data/config/locales/vi.yml +14 -7
  129. data/config/locales/zh-hk.yml +14 -7
  130. data/config/locales/zh-tw.yml +14 -7
  131. data/config/locales/zh.yml +14 -7
  132. data/lib/govuk_publishing_components/presenters/image_card_helper.rb +65 -2
  133. data/lib/govuk_publishing_components/presenters/page_with_step_by_step_navigation.rb +1 -1
  134. data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +4 -0
  135. data/lib/govuk_publishing_components/version.rb +1 -1
  136. data/node_modules/axe-core/README.md +1 -1
  137. data/node_modules/axe-core/axe.d.ts +76 -24
  138. data/node_modules/axe-core/axe.js +4903 -4648
  139. data/node_modules/axe-core/axe.min.js +3 -3
  140. data/node_modules/axe-core/package.json +28 -28
  141. data/node_modules/axe-core/sri-history.json +16 -0
  142. data/node_modules/govuk-frontend/govuk/helpers/_focused.scss +5 -0
  143. data/node_modules/govuk-frontend/package.json +1 -1
  144. metadata +9 -4
  145. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/init-ga4.js +0 -28
@@ -0,0 +1,209 @@
1
+ //= require govuk_publishing_components/analytics
2
+ //= require govuk_publishing_components/analytics-ga4
3
+ //= require govuk_publishing_components/analytics/linked-domains
4
+
5
+ window.GOVUK = window.GOVUK || {}
6
+
7
+ window.GOVUK.loadAnalytics = {
8
+ productionDomains: [
9
+ 'www.gov.uk',
10
+ 'www-origin.publishing.service.gov.uk'
11
+ ],
12
+ stagingDomains: [
13
+ 'www.staging.publishing.service.gov.uk',
14
+ 'www-origin.staging.publishing.service.gov.uk'
15
+ ],
16
+ integrationDomains: [
17
+ 'www.integration.publishing.service.gov.uk',
18
+ 'www-origin.integration.publishing.service.gov.uk'
19
+ ],
20
+ developmentDomains: [
21
+ 'localhost', '127.0.0.1', '0.0.0.0'
22
+ ],
23
+
24
+ // For Universal Analytics' cross domain tracking. linkedDomains is defined by the require statement at the top of the file.
25
+ linkedDomains: window.GOVUK.analytics.linkedDomains,
26
+
27
+ ga4EnvironmentVariables: {
28
+ // initialiseGA4 is used to enable/disable GA4 on specific environments
29
+ production: {
30
+ initialiseGA4: true
31
+ },
32
+ staging: {
33
+ initialiseGA4: true,
34
+ auth: 'oJWs562CxSIjZKn_GlB5Bw',
35
+ preview: 'env-5'
36
+ },
37
+ integration: {
38
+ initialiseGA4: true,
39
+ auth: 'C7iYdcsOlYgGmiUJjZKrHQ',
40
+ preview: 'env-4'
41
+ },
42
+ development: {
43
+ initialiseGA4: true,
44
+ auth: 'bRiZ-jiEHtw6hHpGd6dF9w',
45
+ preview: 'env-3'
46
+ }
47
+ },
48
+
49
+ loadUa: function (currentDomain) {
50
+ // The domain can be overridden. This is needed for testing as we need to fake the domain that we are on to test each environment.
51
+ currentDomain = currentDomain || window.location.hostname
52
+
53
+ // Universal Analytics variables
54
+ window.GOVUK.analyticsVars = window.GOVUK.analyticsVars || {}
55
+ window.GOVUK.analyticsVars.primaryLinkedDomains = ['account.gov.uk']
56
+ window.GOVUK.analyticsVars.linkedDomains = this.linkedDomains
57
+ window.GOVUK.analyticsVars.gaProperty = 'UA-UNSET'
58
+ window.GOVUK.analyticsVars.gaPropertyCrossDomain = 'UA-UNSET'
59
+
60
+ if (this.arrayContains({ valueToFind: currentDomain, array: this.productionDomains })) {
61
+ window.GOVUK.analyticsVars.gaProperty = 'UA-26179049-1'
62
+ window.GOVUK.analyticsVars.gaPropertyCrossDomain = 'UA-145652997-1'
63
+ } else if (this.arrayContains({ valueToFind: currentDomain, array: this.stagingDomains })) {
64
+ window.GOVUK.analyticsVars.gaProperty = 'UA-26179049-20'
65
+ window.GOVUK.analyticsVars.gaPropertyCrossDomain = 'UA-145652997-1'
66
+ } else if (this.arrayContains({ valueToFind: currentDomain, array: this.integrationDomains })) {
67
+ window.GOVUK.analyticsVars.gaProperty = 'UA-26179049-22'
68
+ window.GOVUK.analyticsVars.gaPropertyCrossDomain = 'UA-145652997-1'
69
+ }
70
+
71
+ // Load universal analytics
72
+ if (typeof window.GOVUK.analyticsInit !== 'undefined') {
73
+ window.GOVUK.analyticsInit()
74
+ }
75
+ },
76
+
77
+ loadGa4Vars: function () {
78
+ // If we recognise the environment, load the GA4 vars
79
+ if (this.ga4EnvironmentVariables[this.environment]) {
80
+ window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {}
81
+ window.GOVUK.analyticsGa4.vars = window.GOVUK.analyticsGa4.vars || {}
82
+ window.GOVUK.analyticsGa4.vars.id = 'GTM-MG7HG5W'
83
+ window.GOVUK.analyticsGa4.vars.auth = this.ga4EnvironmentVariables[this.environment].auth
84
+ window.GOVUK.analyticsGa4.vars.preview = this.ga4EnvironmentVariables[this.environment].preview
85
+ window.GOVUK.analyticsGa4.vars.environment = this.environment // Used for testing and debugging
86
+
87
+ window.GOVUK.analyticsGa4.vars.gem_version = 'not found'
88
+ var gemMeta = document.querySelector('meta[name="govuk:components_gem_version"]')
89
+ if (gemMeta) {
90
+ window.GOVUK.analyticsGa4.vars.gem_version = gemMeta.getAttribute('content')
91
+ }
92
+
93
+ window.GOVUK.analyticsGa4.vars.internalDomains = []
94
+ window.GOVUK.analyticsGa4.vars.internalDomains.push(window.GOVUK.analyticsGa4.core.trackFunctions.getHostname())
95
+ window.GOVUK.analyticsGa4.core.trackFunctions.appendDomainsWithoutWWW(window.GOVUK.analyticsGa4.vars.internalDomains)
96
+ }
97
+ },
98
+
99
+ addGtmScriptToDom: function () {
100
+ var firstScript = document.getElementsByTagName('script')[0]
101
+ var newScript = document.createElement('script')
102
+ newScript.async = true
103
+
104
+ // initialise GTM
105
+ window.dataLayer = window.dataLayer || []
106
+ window.dataLayer.push({ 'gtm.blocklist': ['customPixels', 'customScripts', 'html', 'nonGoogleScripts'] })
107
+ window.dataLayer.push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' })
108
+
109
+ var auth = window.GOVUK.analyticsGa4.vars.auth || ''
110
+ var preview = window.GOVUK.analyticsGa4.vars.preview || ''
111
+ if (auth) {
112
+ auth = '&gtm_auth=' + auth
113
+ }
114
+ if (preview) {
115
+ preview = '&gtm_preview=' + preview + '&gtm_cookies_win=x'
116
+ }
117
+
118
+ this.googleSrc = 'https://www.googletagmanager.com/gtm.js?id=' + window.GOVUK.analyticsGa4.vars.id + auth + preview
119
+ newScript.src = this.googleSrc
120
+ firstScript.parentNode.insertBefore(newScript, firstScript)
121
+ },
122
+
123
+ loadGa4: function (currentDomain) {
124
+ // The domain can be overridden. This is needed for testing as we need to fake the domain that we are on to test each environment.
125
+ currentDomain = currentDomain || window.location.hostname
126
+
127
+ window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {}
128
+
129
+ if (typeof window.GOVUK.analyticsGa4.core === 'undefined') {
130
+ console.error('load-analytics.js: window.GOVUK.analyticsGa4.core was not found - has ./analytics-ga4.js been imported?')
131
+ return
132
+ }
133
+
134
+ this.environment = ''
135
+ // Categorise current environment
136
+ if (this.arrayContains({ valueToFind: currentDomain, array: this.productionDomains })) {
137
+ this.environment = 'production'
138
+ } else if (this.arrayContains({ valueToFind: currentDomain, array: this.stagingDomains })) {
139
+ this.environment = 'staging'
140
+ } else if (this.arrayContains({ valueToFind: currentDomain, array: this.integrationDomains })) {
141
+ this.environment = 'integration'
142
+ } else if (this.arrayContains({ valueToFind: currentDomain, array: this.developmentDomains }) || currentDomain.indexOf('.dev.gov.uk') !== -1) {
143
+ this.environment = 'development'
144
+ }
145
+
146
+ if (!this.environment) {
147
+ console.error('load-analytics.js: environment for GA4 not recognised - ' + this.environment + ' on ' + currentDomain)
148
+ return
149
+ }
150
+
151
+ // Don't load GA4 if initialiseGA4 is set to false. This allows us to disable analytics if required.
152
+ if (!this.ga4EnvironmentVariables[this.environment].initialiseGA4) {
153
+ return
154
+ }
155
+
156
+ // to be added: digital identity consent mechanism
157
+ var consentCookie = window.GOVUK.getConsentCookie()
158
+ if (consentCookie && consentCookie.usage) {
159
+ // Creates 'window.GOVUK.analyticsGa4.vars', then adds the gtm.js script to the DOM.
160
+ window.GOVUK.loadAnalytics.loadGa4Vars()
161
+ window.GOVUK.loadAnalytics.addGtmScriptToDom()
162
+
163
+ /* Initialises our GA4 modules once the DOM has loaded.
164
+ document.readyState is needed as when cookies aren't set the DOM is likely already loaded.
165
+ Therefore, if they accept cookies after the page has loaded our modules wouldn't initialise,
166
+ as DOMContentLoaded won't fire if the DOM has already loaded. */
167
+ if (document.readyState === 'complete') {
168
+ window.GOVUK.loadAnalytics.startGa4Modules()
169
+ } else {
170
+ window.addEventListener('DOMContentLoaded', function () {
171
+ window.GOVUK.loadAnalytics.startGa4Modules()
172
+ })
173
+ }
174
+
175
+ // to be added: cross domain tracking code
176
+ } else {
177
+ window.addEventListener('cookie-consent', function (e) {
178
+ window.GOVUK.loadAnalytics.loadGa4()
179
+ })
180
+ }
181
+ },
182
+
183
+ startGa4Modules: function () {
184
+ // Some tests initialise GA4, but we do not want our modules initialising, so this check is in place.
185
+ if (!window.GOVUK.analyticsGa4.vars.disableModules) {
186
+ var analyticsModules = window.GOVUK.analyticsGa4.analyticsModules
187
+ for (var property in analyticsModules) {
188
+ var module = analyticsModules[property]
189
+ if (typeof module.init === 'function') {
190
+ module.init()
191
+ }
192
+ }
193
+ }
194
+ },
195
+
196
+ arrayContains: function (params) {
197
+ if (!params || !params.valueToFind || !params.array) {
198
+ return false
199
+ }
200
+
201
+ return params.array.indexOf(params.valueToFind) !== -1
202
+ }
203
+ }
204
+
205
+ // This if statement stops this function running during testing
206
+ if (!window.jasmine) {
207
+ window.GOVUK.loadAnalytics.loadUa()
208
+ window.GOVUK.loadAnalytics.loadGa4()
209
+ }
@@ -38,8 +38,13 @@
38
38
  if (typeof GOVUK.Modules[moduleName] === 'function' && !started) {
39
39
  // Vanilla JavaScript GOV.UK Modules and GOV.UK Frontend Modules
40
40
  if (GOVUK.Modules[moduleName].prototype.init) {
41
- new GOVUK.Modules[moduleName](element).init()
42
- element.setAttribute('data-' + moduleNames[j] + '-module-started', true)
41
+ try {
42
+ new GOVUK.Modules[moduleName](element).init()
43
+ element.setAttribute('data-' + moduleNames[j] + '-module-started', true)
44
+ } catch (e) {
45
+ // if there's a problem with the module, catch the error to allow other modules to start
46
+ console.error('Error starting ' + moduleName + ' component JS: ' + e.message, window.location)
47
+ }
43
48
  }
44
49
  }
45
50
  }
@@ -95,32 +95,24 @@
95
95
  margin-bottom: 0;
96
96
  width: 100%;
97
97
 
98
- &:hover {
99
- // backup style for browsers that don't support rgba
100
- background: govuk-colour("mid-grey");
101
- background: rgba(govuk-colour("black"), .2);
102
- color: govuk-colour("black");
103
- }
104
-
105
- &:active:focus:not(:hover) {
106
- background: govuk-colour("yellow");
107
- }
108
98
  @include govuk-media-query($from: tablet) {
109
99
  @include govuk-font(16);
110
100
  }
111
- }
112
-
113
- .gem-c-feedback__email-link,
114
- .gem-c-feedback__prompt-link {
115
- position: relative;
116
101
 
102
+ &:focus,
117
103
  &:focus:not(:active):not(:hover) {
104
+ background: govuk-colour("yellow");
118
105
  border-color: govuk-colour("black");
106
+ box-shadow: 0 5px 0 govuk-colour("black");
119
107
  }
120
108
 
121
- &:focus,
122
109
  &:active {
123
- color: $govuk-focus-text-colour;
110
+ color: govuk-colour("black");
111
+ }
112
+
113
+ &:hover {
114
+ background: govuk-colour("mid-grey");
115
+ color: govuk-colour("black");
124
116
  }
125
117
  }
126
118
 
@@ -231,13 +223,17 @@
231
223
  }
232
224
 
233
225
  .gem-c-feedback__email-link {
234
- display: block;
226
+ display: inline-block;
235
227
  margin-top: govuk-spacing(4);
236
228
 
237
229
  @include govuk-media-query($from: desktop) {
238
- display: inline-block;
239
230
  margin-top: govuk-spacing(2);
240
231
  }
232
+
233
+ &:focus,
234
+ &:active {
235
+ color: $govuk-focus-text-colour;
236
+ }
241
237
  }
242
238
 
243
239
  // static.css on GOV.UK overwrites the component styles using input[type="text"]
@@ -131,7 +131,7 @@
131
131
  list-style: none;
132
132
 
133
133
  .gem-c-image-card__list-item {
134
- margin-bottom: govuk-spacing(1);
134
+ margin-bottom: govuk-spacing(2);
135
135
  }
136
136
 
137
137
  .gem-c-image-card__list-item--text {
@@ -208,6 +208,87 @@
208
208
  }
209
209
  }
210
210
 
211
+ // The following two rules are used to 'trick' the
212
+ // Youtube embed into using the desktop styles. Without
213
+ // this, the Youtube embed will use mobile styles in
214
+ // desktop viewports. The Youtube mobile styles are more
215
+ // challenging to use with a keyboard as they are designed
216
+ // for a touch screen interface. There is seemingly no way
217
+ // to make an iframe request the desktop version of a site
218
+ // and there is no parameter in the Youtube embed that would
219
+ // force the desktop styles. Hence this workaround.
220
+
221
+ // In the first rule, we are adding an arbitrarly large
222
+ // enough px to the width of the Youtube iframe so that
223
+ // it will use the desktop styling. Unfortunately, this width
224
+ // would result in the Youtube embed overlapping into the
225
+ // text content. To stop this happening, we scale the size of
226
+ // the embed down.
227
+
228
+ .gem-c-image-card__youtube-video-embed iframe {
229
+ @include govuk-media-query($from: tablet) {
230
+ transform: scale(.7);
231
+ width: calc(100% + 45px);
232
+ }
233
+ z-index: 1;
234
+ }
235
+
236
+ // In the second rule, we scale the container of the embed
237
+ // up by the amount that we scaled the Youtube embed down.
238
+ // This results in the embed being the correct size and the
239
+ // desktop styles being used.
240
+
241
+ .gem-c-image-card__youtube-video-embed {
242
+ @include govuk-media-query($from: tablet) {
243
+ transform: scale(1.3);
244
+ }
245
+ margin: 0;
246
+ padding-bottom: 68%;
247
+ }
248
+
249
+ // This rule is to reposition the embed to the correct
250
+ // place in the image card. As the embed has been scaled
251
+ // down and then scaled up again, it is misaligned and
252
+ // here we correct that misalignment.
253
+
254
+ .gem-c-image-card__youtube-video-embed.gem-c-govspeak__youtube-video iframe {
255
+ @include govuk-media-query($from: tablet) {
256
+ left: -22px;
257
+ top: -10px;
258
+ }
259
+ }
260
+
261
+ .gem-c-image-card__youtube-thumbnail-image-container {
262
+ position: relative;
263
+
264
+ &:before {
265
+ background: url("govuk_publishing_components/youtube-play-icon.png");
266
+ background: url("govuk_publishing_components/youtube-play-icon.svg"), linear-gradient(transparent, transparent);
267
+ background-repeat: no-repeat;
268
+ background-position: 50%;
269
+ background-size: 75px auto;
270
+ content: "";
271
+ height: 100%;
272
+ left: 0;
273
+ position: absolute;
274
+ top: 0;
275
+ width: 100%;
276
+ z-index: 1;
277
+ }
278
+ }
279
+
280
+ .gem-c-image-card__youtube-thumbnail-image {
281
+ filter: brightness(.9);
282
+ }
283
+
284
+ .gem-c-image-card__youtube-thumbnail-container-text {
285
+ margin-top: 10px;
286
+ }
287
+
288
+ .gem-c-image-card__youtube-thumbnail-container:focus .gem-c-image-card__youtube-thumbnail-container-text {
289
+ @include govuk-focused-text;
290
+ }
291
+
211
292
  .gem-c-image-card--no-image {
212
293
  .gem-c-image-card__text-wrapper {
213
294
  @include govuk-media-query($from: mobile, $until: tablet) {
@@ -10,7 +10,7 @@ $search-icon-size: 40px;
10
10
  width: $search-icon-size;
11
11
  height: $search-icon-size;
12
12
  height: govuk-px-to-rem($search-icon-size);
13
- background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 36' width='40' height='40'%3E%3Cpath d='M25.7 24.8L21.9 21c.7-1 1.1-2.2 1.1-3.5 0-3.6-2.9-6.5-6.5-6.5S10 13.9 10 17.5s2.9 6.5 6.5 6.5c1.6 0 3-.6 4.1-1.5l3.7 3.7 1.4-1.4zM12 17.5c0-2.5 2-4.5 4.5-4.5s4.5 2 4.5 4.5-2 4.5-4.5 4.5-4.5-2-4.5-4.5z' fill='currentColor'%3E%3C/path%3E%3C/svg%3E") no-repeat -3px center;
13
+ background: image-url("govuk_publishing_components/icon-search.svg") no-repeat -3px center;
14
14
  }
15
15
 
16
16
  // this overrides styles from static that break the look of the component