@internetstiftelsen/styleguide 2.24.41 → 2.24.43

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.
@@ -25,14 +25,23 @@ var VideoGuideTimeline = function () {
25
25
 
26
26
  if (activeCues.length > 0) {
27
27
  var activeCue = activeCues[0];
28
+ var activePost = _this.posts.find(function (post) {
29
+ return post.dataset.id === activeCue.text;
30
+ });
31
+
32
+ if (activePost) {
33
+ _this.posts.forEach(function (post) {
34
+ post.classList.remove('is-current');
35
+ });
36
+
37
+ activePost.classList.add('is-current');
38
+ }
28
39
 
29
- _this.posts.forEach(function (post) {
40
+ _this.images.forEach(function (post) {
30
41
  if (post.dataset.id === activeCue.text) {
31
42
  post.classList.add('is-current');
32
43
 
33
- if (post.classList.contains('js-timeline-image') && activeCue.id) {
34
- _this.createImageHeadline(activeCue, post);
35
- }
44
+ _this.createImageHeadline(activeCue, post);
36
45
  } else {
37
46
  post.classList.remove('is-current');
38
47
  }
@@ -43,7 +52,8 @@ var VideoGuideTimeline = function () {
43
52
  this.element = element;
44
53
  this.video = video;
45
54
  this.container = element.querySelector('.js-timeline-posts');
46
- this.posts = Array.from(element.querySelectorAll('.js-timeline-post'));
55
+ this.posts = Array.from(element.querySelectorAll('.js-timeline-post:not(.js-timeline-image)'));
56
+ this.images = Array.from(element.querySelectorAll('.js-timeline-image'));
47
57
  this.toggleBtn = element.querySelector('.js-show-timelineposts');
48
58
  this.headlineTpl = element.querySelector('[data-video-headline-tpl]');
49
59
  this.headlineCache = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetstiftelsen/styleguide",
3
- "version": "2.24.41",
3
+ "version": "2.24.43",
4
4
  "main": "dist/components.js",
5
5
  "ports": {
6
6
  "fractal": "3000"
@@ -168,7 +168,7 @@ module.exports = {
168
168
  {
169
169
  name: 'Transparent with icon',
170
170
  context: {
171
- modifiers: ['transparent'],
171
+ modifiers: ['transparent a-button--icon'],
172
172
  text: 'Going home',
173
173
  icon: 'arrow-forwards',
174
174
  el: 'button'
@@ -1,7 +1,7 @@
1
1
  module.exports = {
2
- status: 'wip',
2
+ status: 'ready',
3
3
 
4
4
  context: {
5
-
5
+
6
6
  }
7
- }
7
+ }
@@ -3,7 +3,8 @@ export default class VideoGuideTimeline {
3
3
  this.element = element;
4
4
  this.video = video;
5
5
  this.container = element.querySelector('.js-timeline-posts');
6
- this.posts = Array.from(element.querySelectorAll('.js-timeline-post'));
6
+ this.posts = Array.from(element.querySelectorAll('.js-timeline-post:not(.js-timeline-image)'));
7
+ this.images = Array.from(element.querySelectorAll('.js-timeline-image'));
7
8
  this.toggleBtn = element.querySelector('.js-show-timelineposts');
8
9
  this.headlineTpl = element.querySelector('[data-video-headline-tpl]');
9
10
  this.headlineCache = {};
@@ -59,14 +60,21 @@ export default class VideoGuideTimeline {
59
60
 
60
61
  if (activeCues.length > 0) {
61
62
  const activeCue = activeCues[0];
63
+ const activePost = this.posts.find((post) => post.dataset.id === activeCue.text);
62
64
 
63
- this.posts.forEach((post) => {
65
+ if (activePost) {
66
+ this.posts.forEach((post) => {
67
+ post.classList.remove('is-current');
68
+ });
69
+
70
+ activePost.classList.add('is-current');
71
+ }
72
+
73
+ this.images.forEach((post) => {
64
74
  if (post.dataset.id === activeCue.text) {
65
75
  post.classList.add('is-current');
66
76
 
67
- if (post.classList.contains('js-timeline-image') && activeCue.id) {
68
- this.createImageHeadline(activeCue, post);
69
- }
77
+ this.createImageHeadline(activeCue, post);
70
78
  } else {
71
79
  post.classList.remove('is-current');
72
80
  }
@@ -1,17 +1,8 @@
1
1
  module.exports = {
2
- status: 'prototype',
2
+ status: 'ready',
3
3
 
4
4
  context: {
5
- videoSrc: 'https://ny.internetmuseum.se/app/uploads/2023/01/guidad-tur-nar-internet-kom-till-svenska-hem.mp4',
6
- videoSrc2: 'https://ny.internetmuseum.se/app/uploads/2023/01/guidad-tur-nar-internet-kom-till-svenska-hem-vp9-chrome.webm',
7
-
8
- variants: [
9
- {
10
- name: 'List',
11
- context: {
12
-
13
- }
14
- }
15
- ]
5
+ videoSrc: 'https://internetmuseum.se/app/uploads/2023/01/guidad-tur-nar-internet-kom-till-svenska-hem.mp4',
6
+ videoSrc2: 'https://internetmuseum.se/app/uploads/2023/01/guidad-tur-nar-internet-kom-till-svenska-hem-vp9-chrome.webm',
16
7
  }
17
8
  }