@internetstiftelsen/styleguide 2.26.5-beta.1.0 → 2.26.5

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.
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ document.addEventListener('click', function (e) {
4
+ var el = e.target.closest('[data-ot-dynamic-show-settings]');
5
+
6
+ if (el) {
7
+ var otButton = document.getElementById('ot-sdk-btn');
8
+
9
+ if (otButton) {
10
+ otButton.click();
11
+ }
12
+ }
13
+ });
@@ -59,8 +59,7 @@ function createConsentWarning(el) {
59
59
  div.setAttribute('data-youtube-consent-warning', true);
60
60
  div.className = (0, _className2.default)('m-icon-overlay__message');
61
61
  button.className = (0, _className2.default)('a-button');
62
- button.classList.add('ot-sdk-show-settings');
63
- button.setAttribute('id', 'ot-sdk-btn');
62
+ button.setAttribute('data-ot-dynamic-show-settings', 'true');
64
63
  button.innerHTML = '<span class="' + (0, _className2.default)('a-button__text') + '">Anpassa kakor</span>';
65
64
  message.innerHTML = missingConsentMessage;
66
65
 
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var elements = document.querySelectorAll('.js-height-limit');
4
-
5
4
  function update(innerContainer, button, height) {
6
5
  if (button.classList.contains('is-clicked')) {
7
6
  return;
@@ -25,6 +24,7 @@ function setup(element) {
25
24
  var buttonTextElement = button.querySelector('span');
26
25
  var buttonText = buttonTextElement.innerText;
27
26
  var toggleText = element.getAttribute('data-toggle-text');
27
+ var topPosition = void 0;
28
28
 
29
29
  update(innerContainer, button, height);
30
30
 
@@ -34,6 +34,12 @@ function setup(element) {
34
34
  buttonTextElement.innerText = buttonTextElement.innerText === buttonText ? toggleText : buttonText;
35
35
  button.classList.toggle('is-clicked');
36
36
 
37
+ if (!innerContainer.classList.contains('is-limited')) {
38
+ topPosition = document.documentElement.scrollTop;
39
+ } else {
40
+ window.scroll(0, topPosition);
41
+ }
42
+
37
43
  setTimeout(function () {
38
44
  return update(innerContainer, button, height);
39
45
  }, 1);
@@ -62,4 +62,6 @@ require('./organisms/timeline/timeline');
62
62
 
63
63
  require('./molecules/overview-navigation/overview-navigation');
64
64
 
65
- require('./organisms/schedule/schedule-filter');
65
+ require('./organisms/schedule/schedule-filter');
66
+
67
+ require('./assets/js/ot');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetstiftelsen/styleguide",
3
- "version": "2.26.5-beta.1.0",
3
+ "version": "2.26.5",
4
4
  "main": "dist/components.js",
5
5
  "ports": {
6
6
  "fractal": "3000"
@@ -0,0 +1,11 @@
1
+ document.addEventListener('click', (e) => {
2
+ const el = e.target.closest('[data-ot-dynamic-show-settings]');
3
+
4
+ if (el) {
5
+ const otButton = document.getElementById('ot-sdk-btn');
6
+
7
+ if (otButton) {
8
+ otButton.click();
9
+ }
10
+ }
11
+ });
@@ -44,8 +44,7 @@ function createConsentWarning(el) {
44
44
  div.setAttribute('data-youtube-consent-warning', true);
45
45
  div.className = className('m-icon-overlay__message');
46
46
  button.className = className('a-button');
47
- button.classList.add('ot-sdk-show-settings');
48
- button.setAttribute('id', 'ot-sdk-btn');
47
+ button.setAttribute('data-ot-dynamic-show-settings', 'true');
49
48
  button.innerHTML = `<span class="${className('a-button__text')}">Anpassa kakor</span>`;
50
49
  message.innerHTML = missingConsentMessage;
51
50
 
@@ -30,6 +30,16 @@
30
30
  }
31
31
  }
32
32
 
33
+ @include m(snow) {
34
+ @include e(inner) {
35
+ &.is-limited {
36
+ &::after {
37
+ background-image: linear-gradient(to bottom, rgba($color-snow, 0) 0%, rgba($color-snow, 1) 100%);
38
+ }
39
+ }
40
+ }
41
+ }
42
+
33
43
  @include e(btn) {
34
44
  display: flex;
35
45
  position: relative;
@@ -4,5 +4,13 @@ module.exports = {
4
4
  context: {
5
5
  title: 'Height limiter',
6
6
  description: 'Toggla höjd på en container'
7
- }
7
+ },
8
+ variants: [
9
+ {
10
+ name: 'On white background',
11
+ context: {
12
+ modifiers: ['white']
13
+ }
14
+ }
15
+ ]
8
16
  }
@@ -1,5 +1,4 @@
1
1
  const elements = document.querySelectorAll('.js-height-limit');
2
-
3
2
  function update(innerContainer, button, height) {
4
3
  if (button.classList.contains('is-clicked')) {
5
4
  return;
@@ -23,6 +22,7 @@ function setup(element) {
23
22
  const buttonTextElement = button.querySelector('span');
24
23
  const buttonText = buttonTextElement.innerText;
25
24
  const toggleText = element.getAttribute('data-toggle-text');
25
+ let topPosition;
26
26
 
27
27
  update(innerContainer, button, height);
28
28
 
@@ -34,6 +34,12 @@ function setup(element) {
34
34
  buttonTextElement.innerText === buttonText) ? toggleText : buttonText;
35
35
  button.classList.toggle('is-clicked');
36
36
 
37
+ if (!innerContainer.classList.contains('is-limited')) {
38
+ topPosition = document.documentElement.scrollTop;
39
+ } else {
40
+ window.scroll(0, topPosition);
41
+ }
42
+
37
43
  setTimeout(() => update(innerContainer, button, height), 1);
38
44
  });
39
45
 
package/src/components.js CHANGED
@@ -30,3 +30,4 @@ import './organisms/video-guide/video-guide';
30
30
  import './organisms/timeline/timeline';
31
31
  import './molecules/overview-navigation/overview-navigation';
32
32
  import './organisms/schedule/schedule-filter';
33
+ import './assets/js/ot';
@@ -86,7 +86,8 @@
86
86
 
87
87
  @include e(buttons) {
88
88
  display: flex;
89
- flex-direction: column;
89
+ flex-direction: row;
90
+ flex-wrap: wrap;
90
91
  margin: -#{rhythm(1)} 0 0 -#{rhythm(3)};
91
92
 
92
93
  @include atom(button) {
@@ -133,7 +133,7 @@ module.exports = {
133
133
  context: {
134
134
  no_image_class: 'o-hero--no-break',
135
135
  limited_width: false,
136
- has_button: true,
136
+ has_buttons: true,
137
137
  has_tags: false,
138
138
  has_link: false,
139
139
  has_text: false,
@@ -223,7 +223,6 @@
223
223
  }
224
224
  }
225
225
 
226
-
227
226
  @include e(close-btn) {
228
227
  position: absolute;
229
228
  top: 0;
@@ -236,6 +235,10 @@
236
235
  margin-bottom: rhythm(1);
237
236
  align-items: center;
238
237
 
238
+ > span {
239
+ line-height: 1.2;
240
+ }
241
+
239
242
  @include bp-up(lg) {
240
243
  margin-bottom: 0;
241
244
  }
@@ -248,6 +251,7 @@
248
251
 
249
252
  > span {
250
253
  text-align: center;
254
+ margin-top: rhythm(0.5);
251
255
  }
252
256
  }
253
257
  }