@worksafevictoria/wcl7.5 1.9.0-beta.4 → 1.9.0-beta.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.
- package/package.json +1 -1
- package/src/components/Common/CardGridItem/card-grid-item-caret.vue +39 -45
- package/src/components/Common/CardGridItem/card-grid-item-icon.vue +1 -1
- package/src/components/Common/CardGridItem/index.vue +6 -2
- package/src/components/Containers/Carousel/index.stories.js +2 -1
- package/src/components/Containers/Carousel/index.vue +68 -69
- package/src/components/Containers/HomepageHeader/index.stories.js +1 -1
- package/src/components/Containers/HomepageHeaderNew/index.stories.js +3 -15
- package/src/components/Containers/HomepageHeaderNew/index.vue +0 -5
- package/src/components/Global/AppFooter/index.vue +115 -129
- package/src/components/Global/AppHeader/ModalSearch/index.vue +7 -1
- package/src/components/Global/AppHeader/index.stories.js +2 -2
- package/src/components/Global/AppHeaderNew/ModalSearch/index.vue +21 -17
- package/src/components/Global/AppHeaderNew/index.stories.js +2 -2
- package/src/components/Global/AppHeaderNew/index.vue +22 -22
- package/src/components/Global/BackToTop/index.vue +16 -16
- package/src/components/Global/ContrastMode/index.stories.js +1 -1
- package/src/components/Global/HeroHeader/index.vue +62 -73
- package/src/components/Global/SocialShare/index.vue +62 -66
- package/src/components/Global/Strip/index.vue +9 -5
- package/src/components/Paragraphs/Accordion/AccordionItem/index.vue +21 -23
- package/src/components/Paragraphs/Accordion/StepperItem/index.vue +15 -15
- package/src/components/Paragraphs/Calculator/CardContainer/index.vue +74 -75
- package/src/components/Paragraphs/Calculator/RiskLevel/index.vue +31 -39
- package/src/components/Paragraphs/Directory/Asbestos/Records/SingleRecord/index.vue +104 -107
- package/src/components/Paragraphs/Directory/Asbestos/Records/index.vue +152 -120
- package/src/components/Paragraphs/Directory/HSCP/Records/SingleRecord/index.vue +127 -133
- package/src/components/Paragraphs/Directory/HSCP/Records/index.vue +158 -128
- package/src/components/Paragraphs/TabulatedData/index.vue +3 -2
- package/src/components/SubComponents/CtaButton/index.vue +47 -44
- package/src/components/SubComponents/Icon/README.md +2 -2
- package/src/components/SubComponents/Icon/example.js +1 -0
- package/src/components/SubComponents/Icon/index.stories.js +1 -1
- package/src/components/SubComponents/Icon/index.vue +47 -47
- package/src/components/SubComponents/ResourceGroup/cardbody.vue +49 -61
- package/src/components/SubComponents/VideoThumbnail/index.vue +30 -28
- package/src/mock/carousel-items.js +46 -81
|
@@ -9,8 +9,8 @@ Import the Icon component, and give it the URL path to the SVG file. When webpac
|
|
|
9
9
|
```html
|
|
10
10
|
<template>
|
|
11
11
|
<div id="app">
|
|
12
|
-
<icon width="100" height="100" :glyph="Logo"></icon>
|
|
13
|
-
<icon width="100" height="100" :glyph="Close"></icon>
|
|
12
|
+
<icon width="100" height="100" :glyph="Logo" icon-alt="Logo icon"></icon>
|
|
13
|
+
<icon width="100" height="100" :glyph="Close" icon-alt="Close icon"></icon>
|
|
14
14
|
</div>
|
|
15
15
|
</template>
|
|
16
16
|
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
aria-hidden="true"
|
|
8
8
|
:class="
|
|
9
9
|
className +
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
(first ? ' icon_first' : '') +
|
|
11
|
+
(last ? ' icon_last' : '') +
|
|
12
|
+
(inverted ? ' icon--inverted' : '')
|
|
13
13
|
"
|
|
14
14
|
:width="width"
|
|
15
15
|
:height="height"
|
|
@@ -24,104 +24,104 @@
|
|
|
24
24
|
</template>
|
|
25
25
|
|
|
26
26
|
<script>
|
|
27
|
-
import { detectBrowser } from
|
|
27
|
+
import { detectBrowser } from "../../../../lib/detect-browser";
|
|
28
28
|
// TODO: Add .visually-hidden label prop
|
|
29
29
|
export default {
|
|
30
|
-
name:
|
|
30
|
+
name: "Icon",
|
|
31
31
|
props: {
|
|
32
32
|
className: {
|
|
33
33
|
type: String,
|
|
34
|
-
default:
|
|
34
|
+
default: "",
|
|
35
35
|
},
|
|
36
36
|
glyph: {
|
|
37
37
|
type: [Object, String],
|
|
38
|
-
required: true
|
|
38
|
+
required: true,
|
|
39
39
|
},
|
|
40
40
|
width: {
|
|
41
41
|
type: [Number, String],
|
|
42
|
-
default: 32
|
|
42
|
+
default: 32,
|
|
43
43
|
},
|
|
44
44
|
height: {
|
|
45
45
|
// height is required in IE
|
|
46
46
|
// undefined type added in case height was going to be handled explicitly, check JobsAtHomeDay for more details
|
|
47
47
|
type: [Number, String],
|
|
48
|
-
default: 32
|
|
48
|
+
default: 32,
|
|
49
49
|
},
|
|
50
50
|
first: {
|
|
51
51
|
type: Boolean,
|
|
52
|
-
default: false
|
|
52
|
+
default: false,
|
|
53
53
|
},
|
|
54
54
|
last: {
|
|
55
55
|
type: Boolean,
|
|
56
|
-
default: false
|
|
56
|
+
default: false,
|
|
57
57
|
},
|
|
58
58
|
inverted: {
|
|
59
59
|
type: Boolean,
|
|
60
|
-
default: false
|
|
60
|
+
default: false,
|
|
61
61
|
},
|
|
62
62
|
bordered: {
|
|
63
63
|
type: Boolean,
|
|
64
|
-
default: false
|
|
64
|
+
default: false,
|
|
65
65
|
},
|
|
66
66
|
iconAlt: {
|
|
67
67
|
type: String,
|
|
68
|
-
default:
|
|
69
|
-
}
|
|
68
|
+
default: "",
|
|
69
|
+
},
|
|
70
70
|
},
|
|
71
71
|
data() {
|
|
72
72
|
return {
|
|
73
|
-
renderedSVG: undefined
|
|
74
|
-
}
|
|
73
|
+
renderedSVG: undefined,
|
|
74
|
+
};
|
|
75
75
|
},
|
|
76
76
|
computed: {
|
|
77
77
|
isHtml() {
|
|
78
|
-
return this.glyph && typeof this.glyph ===
|
|
79
|
-
}
|
|
78
|
+
return this.glyph && typeof this.glyph === "string";
|
|
79
|
+
},
|
|
80
80
|
},
|
|
81
81
|
mounted() {
|
|
82
|
-
this.renderedSVG = this.getSvg()
|
|
82
|
+
this.renderedSVG = this.getSvg();
|
|
83
83
|
},
|
|
84
84
|
methods: {
|
|
85
85
|
getSvg() {
|
|
86
86
|
if (this.glyph) {
|
|
87
|
-
let icon
|
|
88
|
-
const content = String(this.glyph)
|
|
89
|
-
const isSVGTag = content.includes(
|
|
87
|
+
let icon;
|
|
88
|
+
const content = String(this.glyph);
|
|
89
|
+
const isSVGTag = content.includes("<svg");
|
|
90
90
|
if (!isSVGTag) {
|
|
91
|
-
icon = document.createElement(
|
|
92
|
-
icon.src = content
|
|
91
|
+
icon = document.createElement("img");
|
|
92
|
+
icon.src = content;
|
|
93
93
|
} else {
|
|
94
|
-
if (window && navigator && detectBrowser(navigator) ===
|
|
95
|
-
return this.glyph
|
|
94
|
+
if (window && navigator && detectBrowser(navigator) === "IE") {
|
|
95
|
+
return this.glyph;
|
|
96
96
|
} else {
|
|
97
|
-
const temp = document.createElement(
|
|
98
|
-
temp.innerHTML = content
|
|
99
|
-
icon = temp.querySelector(
|
|
100
|
-
icon.removeAttribute(
|
|
101
|
-
icon.removeAttribute(
|
|
97
|
+
const temp = document.createElement("div");
|
|
98
|
+
temp.innerHTML = content;
|
|
99
|
+
icon = temp.querySelector("svg");
|
|
100
|
+
icon.removeAttribute("width");
|
|
101
|
+
icon.removeAttribute("height");
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
if (this.iconAlt) {
|
|
105
|
-
icon.setAttribute(
|
|
105
|
+
icon.setAttribute("alt", this.iconAlt);
|
|
106
106
|
}
|
|
107
|
-
icon.setAttribute(
|
|
108
|
-
icon.setAttribute(
|
|
107
|
+
icon.setAttribute("width", this.width);
|
|
108
|
+
icon.setAttribute("height", this.height);
|
|
109
109
|
const customClass =
|
|
110
110
|
this.className +
|
|
111
|
-
(this.first ?
|
|
112
|
-
(this.last ?
|
|
113
|
-
(this.inverted ?
|
|
114
|
-
icon.setAttribute(
|
|
115
|
-
icon.setAttribute(
|
|
116
|
-
icon.setAttribute(
|
|
117
|
-
return icon.outerHTML
|
|
111
|
+
(this.first ? " icon_first" : "") +
|
|
112
|
+
(this.last ? " icon_last" : "") +
|
|
113
|
+
(this.inverted ? " icon--inverted" : "");
|
|
114
|
+
icon.setAttribute("class", "icon " + customClass);
|
|
115
|
+
icon.setAttribute("focusable", false);
|
|
116
|
+
icon.setAttribute("aria-hidden", true);
|
|
117
|
+
return icon.outerHTML;
|
|
118
118
|
}
|
|
119
|
-
return null
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
119
|
+
return null;
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
123
|
</script>
|
|
124
124
|
|
|
125
125
|
<style lang="scss">
|
|
126
|
-
@import
|
|
126
|
+
@import "./styles";
|
|
127
127
|
</style>
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
height="12"
|
|
31
31
|
width="17"
|
|
32
32
|
class="card_item-menu__title__caret"
|
|
33
|
-
alt=""
|
|
33
|
+
alt="Card item Menu Title expand icon"
|
|
34
34
|
/>
|
|
35
35
|
<img
|
|
36
36
|
v-show="cardMenuIsOpen"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
height="12"
|
|
39
39
|
width="17"
|
|
40
40
|
class="card_item-menu__title__caret"
|
|
41
|
-
alt=""
|
|
41
|
+
alt="Card item Menu Title collapse icon"
|
|
42
42
|
/>
|
|
43
43
|
<h3 class="card_item-menu__title--small">
|
|
44
44
|
{{ card.dropdownTitle }}
|
|
@@ -49,60 +49,48 @@
|
|
|
49
49
|
v-if="card.fileType"
|
|
50
50
|
class="card_item-menu__item card_item-menu__item--link"
|
|
51
51
|
:class="{
|
|
52
|
-
'card_item-menu__item--hide': !cardMenuIsOpen
|
|
52
|
+
'card_item-menu__item--hide': !cardMenuIsOpen,
|
|
53
53
|
}"
|
|
54
54
|
>
|
|
55
55
|
{{ card.fileTypeTitle }}
|
|
56
56
|
<column class="card_item__meta card_item__meta--filetype">
|
|
57
|
-
<rich-text
|
|
58
|
-
:content="card.fileType"
|
|
59
|
-
:without-container="true"
|
|
60
|
-
/>
|
|
57
|
+
<rich-text :content="card.fileType" :without-container="true" />
|
|
61
58
|
</column>
|
|
62
59
|
</li>
|
|
63
60
|
<li
|
|
64
61
|
v-if="card.fileSize"
|
|
65
62
|
class="card_item-menu__item card_item-menu__item--link"
|
|
66
63
|
:class="{
|
|
67
|
-
'card_item-menu__item--hide': !cardMenuIsOpen
|
|
64
|
+
'card_item-menu__item--hide': !cardMenuIsOpen,
|
|
68
65
|
}"
|
|
69
66
|
>
|
|
70
67
|
{{ card.fileSizeTitle }}
|
|
71
68
|
<column class="card_item__meta card_item__meta--filesize">
|
|
72
|
-
<rich-text
|
|
73
|
-
:content="card.fileSize"
|
|
74
|
-
:without-container="true"
|
|
75
|
-
/>
|
|
69
|
+
<rich-text :content="card.fileSize" :without-container="true" />
|
|
76
70
|
</column>
|
|
77
71
|
</li>
|
|
78
72
|
<li
|
|
79
73
|
v-if="card.fileLength"
|
|
80
74
|
class="card_item-menu__item card_item-menu__item--link"
|
|
81
75
|
:class="{
|
|
82
|
-
'card_item-menu__item--hide': !cardMenuIsOpen
|
|
76
|
+
'card_item-menu__item--hide': !cardMenuIsOpen,
|
|
83
77
|
}"
|
|
84
78
|
>
|
|
85
79
|
{{ card.fileLengthTitle }}
|
|
86
80
|
<column class="card_item__meta card_item__meta--filelength">
|
|
87
|
-
<rich-text
|
|
88
|
-
:content="card.fileLength"
|
|
89
|
-
:without-container="true"
|
|
90
|
-
/>
|
|
81
|
+
<rich-text :content="card.fileLength" :without-container="true" />
|
|
91
82
|
</column>
|
|
92
83
|
</li>
|
|
93
84
|
<li
|
|
94
85
|
v-if="card.readingLevel"
|
|
95
86
|
class="card_item-menu__item card_item-menu__item--link"
|
|
96
87
|
:class="{
|
|
97
|
-
'card_item-menu__item--hide': !cardMenuIsOpen
|
|
88
|
+
'card_item-menu__item--hide': !cardMenuIsOpen,
|
|
98
89
|
}"
|
|
99
90
|
>
|
|
100
91
|
{{ card.readingLevelTitle }}
|
|
101
92
|
<column class="card_item__meta card_item__meta--readinglevel">
|
|
102
|
-
<rich-text
|
|
103
|
-
:content="card.readingLevel"
|
|
104
|
-
:without-container="true"
|
|
105
|
-
/>
|
|
93
|
+
<rich-text :content="card.readingLevel" :without-container="true" />
|
|
106
94
|
</column>
|
|
107
95
|
</li>
|
|
108
96
|
</ul>
|
|
@@ -119,30 +107,30 @@
|
|
|
119
107
|
</template>
|
|
120
108
|
|
|
121
109
|
<script>
|
|
122
|
-
import Row from
|
|
123
|
-
import Column from
|
|
124
|
-
import CardFooter from
|
|
125
|
-
import documentsvg from
|
|
126
|
-
import CaretUp from
|
|
127
|
-
import CaretDown from
|
|
128
|
-
import RichText from
|
|
110
|
+
import Row from "../../Containers/Row/index.vue";
|
|
111
|
+
import Column from "../../Containers/Column/index.vue";
|
|
112
|
+
import CardFooter from "./cardfooter.vue";
|
|
113
|
+
import documentsvg from "../../../assets/icons/document.svg?url";
|
|
114
|
+
import CaretUp from "../../../assets/icons/caret-up.svg?url";
|
|
115
|
+
import CaretDown from "../../../assets/icons/caret-down.svg?url";
|
|
116
|
+
import RichText from "../../Paragraphs/RichText/index.vue";
|
|
129
117
|
|
|
130
118
|
export default {
|
|
131
119
|
components: {
|
|
132
120
|
Column,
|
|
133
121
|
Row,
|
|
134
122
|
CardFooter,
|
|
135
|
-
RichText
|
|
123
|
+
RichText,
|
|
136
124
|
},
|
|
137
125
|
props: {
|
|
138
126
|
card: {
|
|
139
127
|
type: Object,
|
|
140
|
-
required: true
|
|
128
|
+
required: true,
|
|
141
129
|
},
|
|
142
130
|
resourceType: {
|
|
143
131
|
type: String,
|
|
144
|
-
default:
|
|
145
|
-
}
|
|
132
|
+
default: "resource-group",
|
|
133
|
+
},
|
|
146
134
|
},
|
|
147
135
|
data() {
|
|
148
136
|
return {
|
|
@@ -152,36 +140,36 @@ export default {
|
|
|
152
140
|
documentsvg,
|
|
153
141
|
CaretUp,
|
|
154
142
|
CaretDown,
|
|
155
|
-
windowWidth: 0
|
|
156
|
-
}
|
|
143
|
+
windowWidth: 0,
|
|
144
|
+
};
|
|
157
145
|
},
|
|
158
146
|
computed: {
|
|
159
147
|
isMobile() {
|
|
160
|
-
return this.windowWidth < 768
|
|
148
|
+
return this.windowWidth < 768;
|
|
161
149
|
},
|
|
162
150
|
isResourceGroup() {
|
|
163
|
-
return this.cardResourseType ===
|
|
164
|
-
}
|
|
151
|
+
return this.cardResourseType === "resource-group" ? true : false;
|
|
152
|
+
},
|
|
165
153
|
},
|
|
166
154
|
mounted() {
|
|
167
155
|
this.$nextTick(() => {
|
|
168
|
-
window.addEventListener(
|
|
169
|
-
})
|
|
170
|
-
this.onResize()
|
|
156
|
+
window.addEventListener("resize", this.onResize);
|
|
157
|
+
});
|
|
158
|
+
this.onResize();
|
|
171
159
|
},
|
|
172
160
|
beforeDestroy() {
|
|
173
|
-
window.removeEventListener(
|
|
161
|
+
window.removeEventListener("resize", this.onResize);
|
|
174
162
|
},
|
|
175
163
|
methods: {
|
|
176
164
|
handleMenuItemClick(menuItem) {
|
|
177
165
|
if (this.isMobile || this.isResourceGroup) {
|
|
178
166
|
for (let i = 0; i < menuItem.length; i++) {
|
|
179
|
-
let newMenuItem = menuItem[i]
|
|
167
|
+
let newMenuItem = menuItem[i];
|
|
180
168
|
|
|
181
|
-
this.cardMenuIsOpen = !this.cardMenuIsOpen
|
|
169
|
+
this.cardMenuIsOpen = !this.cardMenuIsOpen;
|
|
182
170
|
|
|
183
|
-
newMenuItem.isOpen = false
|
|
184
|
-
menuItem.splice(i, 1, newMenuItem)
|
|
171
|
+
newMenuItem.isOpen = false;
|
|
172
|
+
menuItem.splice(i, 1, newMenuItem);
|
|
185
173
|
}
|
|
186
174
|
}
|
|
187
175
|
},
|
|
@@ -189,33 +177,33 @@ export default {
|
|
|
189
177
|
if (this.isMobile || this.isResourceGroup) {
|
|
190
178
|
if (event.keyCode === 32 || event.keyCode === 13) {
|
|
191
179
|
for (let i = 0; i < menuItem.length; i++) {
|
|
192
|
-
let newMenuItem = menuItem[i]
|
|
193
|
-
this.cardMenuIsOpen = !this.cardMenuIsOpen
|
|
194
|
-
newMenuItem.isOpen = false
|
|
195
|
-
menuItem.splice(i, 1, newMenuItem)
|
|
180
|
+
let newMenuItem = menuItem[i];
|
|
181
|
+
this.cardMenuIsOpen = !this.cardMenuIsOpen;
|
|
182
|
+
newMenuItem.isOpen = false;
|
|
183
|
+
menuItem.splice(i, 1, newMenuItem);
|
|
196
184
|
}
|
|
197
185
|
}
|
|
198
186
|
}
|
|
199
187
|
},
|
|
200
188
|
onResize() {
|
|
201
|
-
this.windowWidth = window.innerWidth
|
|
202
|
-
let titles = document.getElementsByClassName(
|
|
189
|
+
this.windowWidth = window.innerWidth;
|
|
190
|
+
let titles = document.getElementsByClassName("card_item-menu__title");
|
|
203
191
|
if (Array.isArray(titles)) {
|
|
204
192
|
if (this.isMobile || this.isResourceGroup) {
|
|
205
193
|
titles.forEach((t) => {
|
|
206
|
-
t.setAttribute(
|
|
207
|
-
})
|
|
194
|
+
t.setAttribute("tabIndex", "0");
|
|
195
|
+
});
|
|
208
196
|
} else {
|
|
209
197
|
titles.forEach((t) => {
|
|
210
|
-
t.removeAttribute(
|
|
211
|
-
})
|
|
198
|
+
t.removeAttribute("tabIndex");
|
|
199
|
+
});
|
|
212
200
|
}
|
|
213
201
|
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
};
|
|
217
205
|
</script>
|
|
218
206
|
<style lang="scss" scoped>
|
|
219
|
-
@import
|
|
220
|
-
@import
|
|
207
|
+
@import "../../../includes/scss/all";
|
|
208
|
+
@import "./styles";
|
|
221
209
|
</style>
|
|
@@ -4,21 +4,23 @@
|
|
|
4
4
|
<div class="video-thumbnail">
|
|
5
5
|
<img
|
|
6
6
|
:src="videoThumbnail"
|
|
7
|
-
alt="video
|
|
7
|
+
:alt="`Thumbnail for video: ${video.mediaTitle}`"
|
|
8
8
|
width="100%"
|
|
9
9
|
class="video-thumbnail__image"
|
|
10
10
|
/>
|
|
11
11
|
<img
|
|
12
12
|
:src="VideoPlay"
|
|
13
|
-
alt="
|
|
13
|
+
alt="Video play button"
|
|
14
|
+
aria-hidden="true"
|
|
14
15
|
class="video-thumbnail__button"
|
|
15
16
|
/>
|
|
16
17
|
</div>
|
|
17
18
|
</a>
|
|
18
19
|
<!-- Modal -->
|
|
19
20
|
<b-modal
|
|
20
|
-
:id="`wcl-video-modal`"
|
|
21
|
+
:id="`wcl-video-modal-${video.id}`"
|
|
21
22
|
v-model="showModal"
|
|
23
|
+
title="Video modal"
|
|
22
24
|
scrollable
|
|
23
25
|
class="wcl-video-modal__modal"
|
|
24
26
|
no-footer
|
|
@@ -42,18 +44,18 @@
|
|
|
42
44
|
</template>
|
|
43
45
|
|
|
44
46
|
<script>
|
|
45
|
-
import VideoMedia from
|
|
46
|
-
import VideoPlay from
|
|
47
|
-
import IconClose from
|
|
48
|
-
import { BModal } from
|
|
49
|
-
import axios from
|
|
47
|
+
import VideoMedia from "./../../Paragraphs/VideoPlayer/index.vue";
|
|
48
|
+
import VideoPlay from "./../../../assets/icons/video-play.svg?url";
|
|
49
|
+
import IconClose from "./../../../assets/icons/icon-close.svg?url";
|
|
50
|
+
import { BModal } from "bootstrap-vue-next";
|
|
51
|
+
import axios from "axios";
|
|
50
52
|
|
|
51
53
|
export default {
|
|
52
|
-
name:
|
|
54
|
+
name: "VideoThumbnail",
|
|
53
55
|
components: {
|
|
54
56
|
VideoMedia,
|
|
55
57
|
IconClose,
|
|
56
|
-
|
|
58
|
+
"b-modal": BModal,
|
|
57
59
|
},
|
|
58
60
|
props: {
|
|
59
61
|
video: {
|
|
@@ -66,42 +68,42 @@ export default {
|
|
|
66
68
|
VideoPlay,
|
|
67
69
|
IconClose,
|
|
68
70
|
showModal: false,
|
|
69
|
-
videoThumbnail:
|
|
70
|
-
}
|
|
71
|
+
videoThumbnail: "",
|
|
72
|
+
};
|
|
71
73
|
},
|
|
72
74
|
mounted() {
|
|
73
|
-
this.getVideoThumbnail()
|
|
75
|
+
this.getVideoThumbnail();
|
|
74
76
|
},
|
|
75
77
|
methods: {
|
|
76
78
|
async getVideoThumbnail(url) {
|
|
77
79
|
try {
|
|
78
|
-
if (this.video.provider ===
|
|
79
|
-
this.videoThumbnail = `https://i.ytimg.com/vi/${this.video.id}/maxresdefault.jpg
|
|
80
|
-
const response = await axios.head(this.videoThumbnail)
|
|
80
|
+
if (this.video.provider === "youtube") {
|
|
81
|
+
this.videoThumbnail = `https://i.ytimg.com/vi/${this.video.id}/maxresdefault.jpg`;
|
|
82
|
+
const response = await axios.head(this.videoThumbnail);
|
|
81
83
|
if (response.status === 200) {
|
|
82
84
|
} else {
|
|
83
|
-
this.videoThumbnail = `https://i.ytimg.com/vi/${this.video.id}/hqdefault.jpg
|
|
85
|
+
this.videoThumbnail = `https://i.ytimg.com/vi/${this.video.id}/hqdefault.jpg`;
|
|
84
86
|
}
|
|
85
|
-
} else if (this.video.provider ===
|
|
87
|
+
} else if (this.video.provider === "vimeo") {
|
|
86
88
|
let thumbnail = await axios.get(
|
|
87
|
-
`https://vimeo.com/api/v2/video/${this.video.id}.json
|
|
88
|
-
)
|
|
89
|
+
`https://vimeo.com/api/v2/video/${this.video.id}.json`
|
|
90
|
+
);
|
|
89
91
|
if (thumbnail.data) {
|
|
90
|
-
this.videoThumbnail = thumbnail.data[0].thumbnail_large
|
|
92
|
+
this.videoThumbnail = thumbnail.data[0].thumbnail_large;
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
95
|
} catch (error) {
|
|
94
96
|
if (error.response && error.response.status === 404) {
|
|
95
|
-
this.videoThumbnail = `https://i.ytimg.com/vi/${this.video.id}/hqdefault.jpg
|
|
97
|
+
this.videoThumbnail = `https://i.ytimg.com/vi/${this.video.id}/hqdefault.jpg`;
|
|
96
98
|
} else {
|
|
97
99
|
}
|
|
98
100
|
}
|
|
99
101
|
},
|
|
100
102
|
},
|
|
101
|
-
}
|
|
103
|
+
};
|
|
102
104
|
</script>
|
|
103
105
|
<style lang="scss" scoped>
|
|
104
|
-
@import
|
|
106
|
+
@import "../../../includes/scss/all";
|
|
105
107
|
// Outside wrapper style
|
|
106
108
|
.wcl-video-thumbnail-wrapper {
|
|
107
109
|
margin-bottom: 32px;
|
|
@@ -127,17 +129,17 @@ export default {
|
|
|
127
129
|
left: 50%;
|
|
128
130
|
//height: 68px;
|
|
129
131
|
//width: 68px;
|
|
130
|
-
@include fp(
|
|
131
|
-
@include fp(
|
|
132
|
+
@include fp("height", 65, 68);
|
|
133
|
+
@include fp("width", 65, 68);
|
|
132
134
|
-ms-transform: translate(-50%, -50%);
|
|
133
135
|
transform: translate(-50%, -50%);
|
|
134
136
|
|
|
135
|
-
@include mq(
|
|
137
|
+
@include mq("sm") {
|
|
136
138
|
height: 80px;
|
|
137
139
|
width: 80px;
|
|
138
140
|
}
|
|
139
141
|
|
|
140
|
-
@include mq(
|
|
142
|
+
@include mq("xs") {
|
|
141
143
|
height: 64px;
|
|
142
144
|
width: 64px;
|
|
143
145
|
}
|