@worksafevictoria/wcl7.5 1.9.0-beta.3 → 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/Search/index.vue +4 -0
- package/src/components/SubComponents/VideoThumbnail/index.vue +30 -28
- package/src/mock/carousel-items.js +46 -81
|
@@ -1,30 +1,48 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<section-group class="paragraph--directory dir-filters">
|
|
3
3
|
<!-- Filters -->
|
|
4
|
-
<row style="column-gap: 16px
|
|
4
|
+
<row style="column-gap: 16px">
|
|
5
5
|
<!-- Keyword Filters -->
|
|
6
6
|
<column xxl="2" xl="3" md="4" sm="6">
|
|
7
7
|
<label class="visually-hidden" for="search-directory">
|
|
8
8
|
Search by keyword (typed keyword automatically filters below results)
|
|
9
9
|
</label>
|
|
10
|
-
<input
|
|
10
|
+
<input
|
|
11
|
+
type="text"
|
|
12
|
+
v-model="searchOrg"
|
|
13
|
+
placeholder="Organisation"
|
|
14
|
+
class="search"
|
|
15
|
+
/>
|
|
11
16
|
</column>
|
|
12
17
|
<column xxl="2" xl="3" md="4" sm="6">
|
|
13
18
|
<label class="visually-hidden" for="search-directory">
|
|
14
19
|
Search by suburb (typed suburb automatically filters below results)
|
|
15
20
|
</label>
|
|
16
|
-
<input
|
|
21
|
+
<input
|
|
22
|
+
type="text"
|
|
23
|
+
v-model="searchSub"
|
|
24
|
+
placeholder="Training location"
|
|
25
|
+
class="search"
|
|
26
|
+
/>
|
|
17
27
|
</column>
|
|
18
28
|
<!-- Other Filters -->
|
|
19
29
|
<column xxl="2" xl="3" md="4" sm="6">
|
|
30
|
+
<label class="visually-hidden" for="filterType"> Filter Type </label>
|
|
20
31
|
<select id="filterType" v-model="searchCourse" name="filter" class="selectClass">
|
|
21
|
-
<option class="placeholder" value="" disabled hidden selected>
|
|
32
|
+
<option class="placeholder" value="" disabled hidden selected>
|
|
33
|
+
Course type
|
|
34
|
+
</option>
|
|
22
35
|
<option value="HSR Initial">HSR Initial</option>
|
|
23
36
|
<option value="HSR Refresher">HSR Refresher</option>
|
|
24
37
|
</select>
|
|
25
38
|
</column>
|
|
26
39
|
<column xxl="2" xl="3" md="4" sm="6">
|
|
27
|
-
<select
|
|
40
|
+
<select
|
|
41
|
+
id="filterTheme"
|
|
42
|
+
v-model="searchThemes"
|
|
43
|
+
name="filter1"
|
|
44
|
+
class="selectClass"
|
|
45
|
+
>
|
|
28
46
|
<option class="placeholder" value="" disabled hidden selected>Theme</option>
|
|
29
47
|
<option v-for="(opt, i) in themeOptions" :key="i" :value="opt">
|
|
30
48
|
{{ opt }}
|
|
@@ -42,54 +60,51 @@
|
|
|
42
60
|
</column>
|
|
43
61
|
</row>
|
|
44
62
|
<!-- HSCP Records -->
|
|
45
|
-
<div class="dirRecords"
|
|
46
|
-
<template v-for="(item, index) in resultChunks[page]"
|
|
47
|
-
<hscp-record v-if="item.type === 'hscp'" :key="index" :item="item"/>
|
|
63
|
+
<div class="dirRecords">
|
|
64
|
+
<template v-for="(item, index) in resultChunks[page]">
|
|
65
|
+
<hscp-record v-if="item.type === 'hscp'" :key="index" :item="item" />
|
|
48
66
|
</template>
|
|
49
67
|
</div>
|
|
50
68
|
<div v-if="filteredRecords.length > 0" align-items="center">
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
69
|
+
<pagination
|
|
70
|
+
:total-pages="totalPages"
|
|
71
|
+
:total="totalResults"
|
|
72
|
+
:per-page="perPage"
|
|
73
|
+
:current-page="page + 1"
|
|
74
|
+
@pagechanged="pageChanged($event)"
|
|
75
|
+
/>
|
|
76
|
+
</div>
|
|
59
77
|
<h4 v-if="filteredRecords.length === 0">No records found</h4>
|
|
60
|
-
|
|
61
78
|
</section-group>
|
|
62
|
-
|
|
63
79
|
</template>
|
|
64
80
|
|
|
65
81
|
<script>
|
|
66
|
-
|
|
67
|
-
import
|
|
68
|
-
import
|
|
69
|
-
import
|
|
70
|
-
import
|
|
71
|
-
import Pagination from './pagination.vue'
|
|
82
|
+
import hscpRecord from "./SingleRecord/index.vue";
|
|
83
|
+
import searchIcon from "./../../../../../assets/icons/search.svg?url";
|
|
84
|
+
import SectionGroup from "../../../../Containers/SectionGroup/index.vue";
|
|
85
|
+
import FilterButton from "../../../../Common/FilterButton/index.vue"; //Reset
|
|
86
|
+
import Pagination from "./pagination.vue";
|
|
72
87
|
|
|
73
88
|
export default {
|
|
74
|
-
name:
|
|
89
|
+
name: "HSCP",
|
|
75
90
|
components: {
|
|
76
91
|
hscpRecord,
|
|
77
92
|
SectionGroup,
|
|
78
93
|
FilterButton,
|
|
79
|
-
Pagination
|
|
94
|
+
Pagination,
|
|
80
95
|
},
|
|
81
96
|
data() {
|
|
82
97
|
return {
|
|
83
|
-
searchOrg:
|
|
84
|
-
searchSub:
|
|
85
|
-
searchCourse:
|
|
86
|
-
searchThemes:
|
|
98
|
+
searchOrg: "",
|
|
99
|
+
searchSub: "",
|
|
100
|
+
searchCourse: "",
|
|
101
|
+
searchThemes: "",
|
|
87
102
|
filteredItems: null,
|
|
88
103
|
perPage: 10,
|
|
89
104
|
page: 0,
|
|
90
105
|
searchIcon,
|
|
91
|
-
hideReset: true
|
|
92
|
-
}
|
|
106
|
+
hideReset: true,
|
|
107
|
+
};
|
|
93
108
|
},
|
|
94
109
|
props: {
|
|
95
110
|
items: {
|
|
@@ -97,23 +112,22 @@ export default {
|
|
|
97
112
|
required: true,
|
|
98
113
|
},
|
|
99
114
|
},
|
|
100
|
-
|
|
101
|
-
computed: {
|
|
102
115
|
|
|
116
|
+
computed: {
|
|
103
117
|
themeOptions() {
|
|
104
118
|
// Concatenate all themes, remove duplicates, sort and use for a drop-down list
|
|
105
|
-
let allThemes = this.flatRecords.map(a => a.themes)
|
|
106
|
-
allThemes = allThemes.join(
|
|
107
|
-
allThemes = allThemes.trim()
|
|
108
|
-
allThemes = allThemes.split(
|
|
119
|
+
let allThemes = this.flatRecords.map((a) => a.themes);
|
|
120
|
+
allThemes = allThemes.join(",");
|
|
121
|
+
allThemes = allThemes.trim();
|
|
122
|
+
allThemes = allThemes.split(",");
|
|
109
123
|
// Change all themes to title case
|
|
110
124
|
for (var i = 0; i < allThemes.length; i++) {
|
|
111
|
-
let newVal = this.toTitleCase(allThemes[i])
|
|
112
|
-
allThemes[i] = newVal
|
|
125
|
+
let newVal = this.toTitleCase(allThemes[i]);
|
|
126
|
+
allThemes[i] = newVal;
|
|
113
127
|
}
|
|
114
128
|
// Remove duplicates
|
|
115
|
-
let s = new Set(allThemes)
|
|
116
|
-
allThemes = [...s]
|
|
129
|
+
let s = new Set(allThemes);
|
|
130
|
+
allThemes = [...s];
|
|
117
131
|
|
|
118
132
|
// Sort the themes
|
|
119
133
|
let sortedThemes = allThemes.sort((a, b) => {
|
|
@@ -124,42 +138,55 @@ export default {
|
|
|
124
138
|
return 1;
|
|
125
139
|
}
|
|
126
140
|
return 0;
|
|
127
|
-
})
|
|
128
|
-
allThemes = sortedThemes
|
|
141
|
+
});
|
|
142
|
+
allThemes = sortedThemes;
|
|
129
143
|
|
|
130
|
-
return allThemes
|
|
144
|
+
return allThemes;
|
|
131
145
|
},
|
|
132
146
|
|
|
133
147
|
filteredRecords() {
|
|
134
|
-
let results = this.flatRecords
|
|
135
|
-
|
|
148
|
+
let results = this.flatRecords;
|
|
149
|
+
|
|
136
150
|
if (this.searchOrg.length) {
|
|
137
|
-
this.hideReset = false
|
|
138
|
-
results = results.filter(item =>
|
|
151
|
+
this.hideReset = false;
|
|
152
|
+
results = results.filter((item) =>
|
|
153
|
+
item.title.toLowerCase().includes(this.searchOrg.toLowerCase())
|
|
154
|
+
);
|
|
139
155
|
}
|
|
140
156
|
if (this.searchSub.length) {
|
|
141
|
-
this.hideReset = false
|
|
142
|
-
results = results.filter(item =>
|
|
157
|
+
this.hideReset = false;
|
|
158
|
+
results = results.filter((item) =>
|
|
159
|
+
item.trainingVenues.toLowerCase().includes(this.searchSub.toLowerCase())
|
|
160
|
+
);
|
|
143
161
|
}
|
|
144
162
|
if (this.searchCourse.length) {
|
|
145
|
-
this.hideReset = false
|
|
146
|
-
results = results.filter(item =>
|
|
163
|
+
this.hideReset = false;
|
|
164
|
+
results = results.filter((item) =>
|
|
165
|
+
item.courses.toLowerCase().includes(this.searchCourse.toLowerCase())
|
|
166
|
+
);
|
|
147
167
|
}
|
|
148
168
|
if (this.searchThemes.length) {
|
|
149
|
-
this.hideReset = false
|
|
150
|
-
results = results.filter(item =>
|
|
169
|
+
this.hideReset = false;
|
|
170
|
+
results = results.filter((item) =>
|
|
171
|
+
item.themes.toLowerCase().includes(this.searchThemes.toLowerCase())
|
|
172
|
+
);
|
|
151
173
|
}
|
|
152
|
-
this.filteredItems = results
|
|
174
|
+
this.filteredItems = results;
|
|
153
175
|
|
|
154
|
-
if (
|
|
155
|
-
this.
|
|
176
|
+
if (
|
|
177
|
+
this.searchOrg.length ||
|
|
178
|
+
this.searchSub.length ||
|
|
179
|
+
this.searchCourse.length ||
|
|
180
|
+
this.searchThemes.length
|
|
181
|
+
) {
|
|
182
|
+
this.pageChanged(1);
|
|
156
183
|
}
|
|
157
184
|
|
|
158
|
-
return results
|
|
185
|
+
return results;
|
|
159
186
|
},
|
|
160
|
-
|
|
187
|
+
|
|
161
188
|
flatRecords() {
|
|
162
|
-
let flatRecords = []
|
|
189
|
+
let flatRecords = [];
|
|
163
190
|
const sortedItems = this.items.sort((a, b) => {
|
|
164
191
|
if (a.Organisation < b.Organisation) {
|
|
165
192
|
return -1;
|
|
@@ -168,10 +195,10 @@ export default {
|
|
|
168
195
|
return 1;
|
|
169
196
|
}
|
|
170
197
|
return 0;
|
|
171
|
-
})
|
|
172
|
-
|
|
198
|
+
});
|
|
199
|
+
sortedItems.forEach((record) => {
|
|
173
200
|
flatRecords.push({
|
|
174
|
-
type:
|
|
201
|
+
type: "hscp",
|
|
175
202
|
title: record.Organisation,
|
|
176
203
|
fullAddress: record.Main_office_address,
|
|
177
204
|
orgAcronym: record.Organisation_acronym,
|
|
@@ -185,116 +212,119 @@ export default {
|
|
|
185
212
|
contact2: record.Contact_2_Name,
|
|
186
213
|
email2: record.Contact_2_Email,
|
|
187
214
|
phone2: record.Contact_2_Phone,
|
|
188
|
-
courses: record.Training_courses.replace(/,$/,
|
|
189
|
-
themes: record.Themes.replace(/,$/,
|
|
190
|
-
trainingVenues: record.Training_venues
|
|
191
|
-
})
|
|
192
|
-
})
|
|
193
|
-
return flatRecords
|
|
215
|
+
courses: record.Training_courses.replace(/,$/, ""),
|
|
216
|
+
themes: record.Themes.replace(/,$/, ""),
|
|
217
|
+
trainingVenues: record.Training_venues,
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
return flatRecords;
|
|
194
221
|
},
|
|
195
222
|
resultChunks() {
|
|
196
|
-
return this.chunkify(this.filteredItems || this.items, this.perPage)
|
|
223
|
+
return this.chunkify(this.filteredItems || this.items, this.perPage);
|
|
197
224
|
},
|
|
198
225
|
noRecordsFound() {
|
|
199
|
-
return this.resultChunks[0].length === 0
|
|
226
|
+
return this.resultChunks[0].length === 0;
|
|
200
227
|
},
|
|
201
228
|
totalResults() {
|
|
202
|
-
return Array.isArray(this.filteredItems) ? this.filteredItems.length : 0
|
|
229
|
+
return Array.isArray(this.filteredItems) ? this.filteredItems.length : 0;
|
|
203
230
|
},
|
|
204
231
|
totalPages() {
|
|
205
|
-
return this.resultChunks.length
|
|
232
|
+
return this.resultChunks.length;
|
|
206
233
|
},
|
|
207
234
|
pageResultCount() {
|
|
208
|
-
return this.resultChunks[this.page].length
|
|
209
|
-
}
|
|
235
|
+
return this.resultChunks[this.page].length;
|
|
236
|
+
},
|
|
210
237
|
},
|
|
211
|
-
|
|
212
|
-
methods: {
|
|
213
238
|
|
|
239
|
+
methods: {
|
|
214
240
|
formatWebsite(url) {
|
|
215
|
-
let startUrl = url.slice(0, 3)
|
|
216
|
-
let returnUrl = url
|
|
217
|
-
if (startUrl.toLowerCase() ===
|
|
218
|
-
returnUrl =
|
|
219
|
-
}
|
|
220
|
-
if (
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
241
|
+
let startUrl = url.slice(0, 3);
|
|
242
|
+
let returnUrl = url;
|
|
243
|
+
if (startUrl.toLowerCase() === "www") {
|
|
244
|
+
returnUrl = "https://" + url;
|
|
245
|
+
}
|
|
246
|
+
if (
|
|
247
|
+
startUrl.toLowerCase() !== "htt" &&
|
|
248
|
+
startUrl.toLowerCase() !== "www" &&
|
|
249
|
+
url !== ""
|
|
250
|
+
) {
|
|
251
|
+
returnUrl = "https://www." + url;
|
|
252
|
+
}
|
|
253
|
+
return returnUrl;
|
|
224
254
|
},
|
|
225
255
|
|
|
226
256
|
chunkify(arr, n) {
|
|
227
257
|
if (arr) {
|
|
228
258
|
const chunked = arr.reduce(
|
|
229
259
|
(chunk, val) => {
|
|
230
|
-
if (chunk[chunk.length - 1].length === n) chunk.push([])
|
|
231
|
-
chunk[chunk.length - 1].push(val)
|
|
232
|
-
return chunk
|
|
260
|
+
if (chunk[chunk.length - 1].length === n) chunk.push([]);
|
|
261
|
+
chunk[chunk.length - 1].push(val);
|
|
262
|
+
return chunk;
|
|
233
263
|
},
|
|
234
264
|
[[]]
|
|
235
|
-
)
|
|
236
|
-
return chunked
|
|
265
|
+
);
|
|
266
|
+
return chunked;
|
|
237
267
|
}
|
|
238
|
-
return [[]]
|
|
268
|
+
return [[]];
|
|
239
269
|
},
|
|
240
|
-
|
|
270
|
+
|
|
241
271
|
reset() {
|
|
242
|
-
this.collapseOrgs(
|
|
243
|
-
this.hideReset = true
|
|
244
|
-
this.searchOrg =
|
|
245
|
-
this.searchCourse =
|
|
246
|
-
this.searchSub =
|
|
247
|
-
this.searchThemes =
|
|
272
|
+
this.collapseOrgs("No");
|
|
273
|
+
this.hideReset = true;
|
|
274
|
+
this.searchOrg = "";
|
|
275
|
+
this.searchCourse = "";
|
|
276
|
+
this.searchSub = "";
|
|
277
|
+
this.searchThemes = "";
|
|
248
278
|
},
|
|
249
279
|
|
|
250
280
|
pageChanged(ev) {
|
|
251
|
-
this.page = ev - 1
|
|
281
|
+
this.page = ev - 1;
|
|
252
282
|
|
|
253
|
-
if (
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
283
|
+
if (
|
|
284
|
+
this.searchOrg.length ||
|
|
285
|
+
this.searchSub.length ||
|
|
286
|
+
this.searchCourse.length ||
|
|
287
|
+
this.searchThemes.length
|
|
288
|
+
) {
|
|
289
|
+
// don't set focus
|
|
290
|
+
// don't collapseOrgs
|
|
291
|
+
} else {
|
|
292
|
+
// set focus to top element - used instead of scrollTo
|
|
293
|
+
this.collapseOrgs("Yes");
|
|
294
|
+
}
|
|
260
295
|
},
|
|
261
296
|
|
|
262
297
|
collapseOrgs(focusLink) {
|
|
263
298
|
// called by pageChanged and reset. pageChanged called by filter and by pagination links
|
|
264
|
-
const aLinks = document.getElementsByName(
|
|
299
|
+
const aLinks = document.getElementsByName("titleLink");
|
|
265
300
|
// Convert nodelist to array
|
|
266
|
-
let linksArr = Array.from(aLinks)
|
|
301
|
+
let linksArr = Array.from(aLinks);
|
|
267
302
|
if (Array.isArray(linksArr) && linksArr.length > 0) {
|
|
268
303
|
linksArr
|
|
269
|
-
.filter((link) => link.getAttribute(
|
|
270
|
-
.forEach((link) => link.click())
|
|
304
|
+
.filter((link) => link.getAttribute("aria-expanded") === "true")
|
|
305
|
+
.forEach((link) => link.click());
|
|
271
306
|
|
|
272
|
-
if (focusLink ===
|
|
273
|
-
linksArr[0].focus()
|
|
307
|
+
if (focusLink === "Yes") {
|
|
308
|
+
linksArr[0].focus();
|
|
274
309
|
}
|
|
275
310
|
}
|
|
276
|
-
|
|
277
311
|
},
|
|
278
312
|
|
|
279
313
|
toTitleCase(strVal) {
|
|
314
|
+
let retVal = strVal.trim();
|
|
280
315
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
const
|
|
284
|
-
const firstCharU = firstChar.toUpperCase()
|
|
285
|
-
const remChar = retVal.slice(1)
|
|
316
|
+
const firstChar = retVal.charAt(0);
|
|
317
|
+
const firstCharU = firstChar.toUpperCase();
|
|
318
|
+
const remChar = retVal.slice(1);
|
|
286
319
|
|
|
287
|
-
retVal = firstCharU + remChar
|
|
320
|
+
retVal = firstCharU + remChar;
|
|
288
321
|
|
|
289
|
-
return retVal
|
|
322
|
+
return retVal;
|
|
290
323
|
},
|
|
291
|
-
}
|
|
292
|
-
}
|
|
324
|
+
},
|
|
325
|
+
};
|
|
293
326
|
</script>
|
|
294
327
|
|
|
295
328
|
<style lang="scss" scoped>
|
|
296
|
-
|
|
297
|
-
@import '../styles.scss'
|
|
298
|
-
|
|
299
|
-
|
|
329
|
+
@import "../styles.scss";
|
|
300
330
|
</style>
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
<span
|
|
23
23
|
class="iconHeader table-active"
|
|
24
24
|
tabindex="0"
|
|
25
|
+
role="button"
|
|
25
26
|
@keypress.enter="accessSort(data.field)"
|
|
26
27
|
scope="colgroup"
|
|
27
28
|
>
|
|
@@ -31,13 +32,13 @@
|
|
|
31
32
|
v-if="data.field.thAttr['aria-sort'] === 'ascending'"
|
|
32
33
|
:src="CaretUp"
|
|
33
34
|
alt="image indicating ascending sort"
|
|
34
|
-
class="
|
|
35
|
+
class="collapse icon"
|
|
35
36
|
/>
|
|
36
37
|
<img
|
|
37
38
|
v-else-if="data.field.thAttr['aria-sort'] === 'descending'"
|
|
38
39
|
:src="CaretDown"
|
|
39
40
|
alt="image indicating descending sort"
|
|
40
|
-
class="
|
|
41
|
+
class="expand icon"
|
|
41
42
|
/>
|
|
42
43
|
</span>
|
|
43
44
|
</span>
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
:height="glyphHeight"
|
|
14
14
|
:glyph="glyph"
|
|
15
15
|
:class="glyphClass"
|
|
16
|
+
icon-alt="button icon"
|
|
16
17
|
/>
|
|
17
18
|
<arrow-right v-else-if="!rtl && !textOnly" :class="glyphClass" />
|
|
18
19
|
<arrow-left v-else-if="!textOnly" :class="glyphClass" />
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
:height="glyphHeight"
|
|
37
38
|
:glyph="glyph"
|
|
38
39
|
:class="glyphClass"
|
|
40
|
+
icon-alt="anchor icon"
|
|
39
41
|
/>
|
|
40
42
|
<arrow-right v-else-if="!rtl && !textOnly" :class="glyphClass" />
|
|
41
43
|
<arrow-left v-else-if="!textOnly" :class="glyphClass" />
|
|
@@ -59,6 +61,7 @@
|
|
|
59
61
|
:height="glyphHeight"
|
|
60
62
|
:glyph="glyph"
|
|
61
63
|
:class="glyphClass"
|
|
64
|
+
icon-alt="link icon"
|
|
62
65
|
/>
|
|
63
66
|
<arrow-right v-else-if="!rtl && !textOnly" :class="glyphClass" />
|
|
64
67
|
<arrow-left v-else-if="!textOnly" :class="glyphClass" />
|
|
@@ -66,12 +69,12 @@
|
|
|
66
69
|
</template>
|
|
67
70
|
|
|
68
71
|
<script>
|
|
69
|
-
import arrowRight from
|
|
70
|
-
import arrowLeft from
|
|
71
|
-
import icon from
|
|
72
|
+
import arrowRight from "../../../assets/icons/arrow-right.svg?component";
|
|
73
|
+
import arrowLeft from "../../../assets/icons/arrow-left.svg?component";
|
|
74
|
+
import icon from "./../Icon/index.vue";
|
|
72
75
|
|
|
73
76
|
export default {
|
|
74
|
-
name:
|
|
77
|
+
name: "CtaButton",
|
|
75
78
|
components: {
|
|
76
79
|
arrowRight,
|
|
77
80
|
arrowLeft,
|
|
@@ -80,18 +83,18 @@ export default {
|
|
|
80
83
|
props: {
|
|
81
84
|
type: {
|
|
82
85
|
type: String,
|
|
83
|
-
default:
|
|
86
|
+
default: "default",
|
|
84
87
|
validator: (value) =>
|
|
85
|
-
[
|
|
88
|
+
["default", "white", "gray", "workwell", "dark"].indexOf(value) >= 0,
|
|
86
89
|
},
|
|
87
90
|
url: {
|
|
88
91
|
type: String,
|
|
89
92
|
required: false,
|
|
90
|
-
default:
|
|
93
|
+
default: "",
|
|
91
94
|
},
|
|
92
95
|
alt: {
|
|
93
96
|
type: String,
|
|
94
|
-
default:
|
|
97
|
+
default: "",
|
|
95
98
|
},
|
|
96
99
|
rtl: {
|
|
97
100
|
type: Boolean,
|
|
@@ -138,15 +141,15 @@ export default {
|
|
|
138
141
|
},
|
|
139
142
|
focusOutline: {
|
|
140
143
|
type: String,
|
|
141
|
-
default:
|
|
142
|
-
validator: (value) => [
|
|
144
|
+
default: "default",
|
|
145
|
+
validator: (value) => ["default", "light", "dark"].indexOf(value) >= 0,
|
|
143
146
|
},
|
|
144
147
|
},
|
|
145
148
|
data() {
|
|
146
149
|
return {
|
|
147
150
|
arrowRight,
|
|
148
151
|
arrowLeft,
|
|
149
|
-
}
|
|
152
|
+
};
|
|
150
153
|
},
|
|
151
154
|
computed: {
|
|
152
155
|
// var r = new RegExp('^(?:[a-z]+:)?//', 'i');
|
|
@@ -158,81 +161,81 @@ export default {
|
|
|
158
161
|
// r.test('/myfolder/test.txt'); // false - relative URL
|
|
159
162
|
// r.test('test'); // false - also relative URL
|
|
160
163
|
isAbsolute() {
|
|
161
|
-
let r = new RegExp(
|
|
162
|
-
return r.test(this.url)
|
|
164
|
+
let r = new RegExp("^(?:[a-z]+:)?//", "i");
|
|
165
|
+
return r.test(this.url);
|
|
163
166
|
},
|
|
164
167
|
// Some links come out of Drupal in the format `entity:node/551`
|
|
165
168
|
// As an interim solution, make the link go to `node/551` and it
|
|
166
169
|
// will render correctly. Not ideal as it doesn't forward to the
|
|
167
170
|
// friendly link. Should come out of Drupal with a proper alias.
|
|
168
171
|
linkUriProcessed() {
|
|
169
|
-
if (this.url?.indexOf(
|
|
170
|
-
return this.url.slice(7)
|
|
171
|
-
} else if (this.url?.indexOf(
|
|
172
|
-
return this.url.slice(9)
|
|
172
|
+
if (this.url?.indexOf("entity:") === 0) {
|
|
173
|
+
return this.url.slice(7);
|
|
174
|
+
} else if (this.url?.indexOf("internal:") === 0) {
|
|
175
|
+
return this.url.slice(9);
|
|
173
176
|
} else {
|
|
174
|
-
return this.url
|
|
177
|
+
return this.url;
|
|
175
178
|
}
|
|
176
179
|
},
|
|
177
180
|
generatedClass() {
|
|
178
|
-
return `wcl-cta ${this.type} ${this.rtl ?
|
|
179
|
-
this.workwell ?
|
|
180
|
-
} ${this.isCentred ?
|
|
181
|
-
this.textOnly ?
|
|
182
|
-
} ${this.stretch ?
|
|
183
|
-
|
|
184
|
-
}
|
|
181
|
+
return `wcl-cta ${this.type} ${this.rtl ? "rtl" : ""} ${
|
|
182
|
+
this.workwell ? "workwell" : ""
|
|
183
|
+
} ${this.isCentred ? "text-center" : ""} ${
|
|
184
|
+
this.textOnly ? "wcl-cta--text-only" : ""
|
|
185
|
+
} ${this.stretch ? "wcl-cta--stretch" : ""} ${this.slim ? "wcl-cta--slim" : ""} ${
|
|
186
|
+
"wcl-cta--focus-" + this.focusOutline
|
|
187
|
+
}`;
|
|
185
188
|
},
|
|
186
189
|
glyphClass() {
|
|
187
|
-
const hasArrow = !this.glyph && !this.textOnly
|
|
190
|
+
const hasArrow = !this.glyph && !this.textOnly;
|
|
188
191
|
return this.isCentred
|
|
189
|
-
? { [
|
|
192
|
+
? { ["wcl-cta__arrow"]: hasArrow }
|
|
190
193
|
: {
|
|
191
|
-
[
|
|
192
|
-
}
|
|
194
|
+
["wcl-cta__arrow"]: hasArrow,
|
|
195
|
+
};
|
|
193
196
|
},
|
|
194
197
|
textClass() {
|
|
195
|
-
return this.isCentred ? {} : {}
|
|
198
|
+
return this.isCentred ? {} : {};
|
|
196
199
|
},
|
|
197
200
|
},
|
|
198
201
|
methods: {
|
|
199
202
|
clicked() {
|
|
200
|
-
var theEl = this.$el.getElementsByClassName(
|
|
201
|
-
var attrs
|
|
203
|
+
var theEl = this.$el.getElementsByClassName("wcl-cta__link-text");
|
|
204
|
+
var attrs;
|
|
202
205
|
if (theEl && theEl.length > 0) {
|
|
203
206
|
attrs = {
|
|
204
207
|
//group: this.$store?.state?.page?.content?.title,
|
|
205
208
|
group: this.$pageStore?.content?.title,
|
|
206
|
-
label: theEl[0]?.innerText?.split(
|
|
209
|
+
label: theEl[0]?.innerText?.split("\n")[0],
|
|
207
210
|
data: this.url,
|
|
208
|
-
}
|
|
211
|
+
};
|
|
209
212
|
} else {
|
|
210
213
|
attrs = {
|
|
211
214
|
//group: this.$store?.state?.page?.content?.title,
|
|
212
215
|
group: this.$pageStore?.content?.title,
|
|
213
|
-
label:
|
|
216
|
+
label: "",
|
|
214
217
|
data: this.url,
|
|
215
|
-
}
|
|
218
|
+
};
|
|
216
219
|
}
|
|
217
220
|
// push event to gtm
|
|
218
221
|
if (this.$gtm) {
|
|
219
|
-
this.$gtm.push({ event:
|
|
222
|
+
this.$gtm.push({ event: "custom.interaction.cta.click", ...attrs });
|
|
220
223
|
}
|
|
221
224
|
// navigate to url
|
|
222
225
|
if (!this.url) {
|
|
223
226
|
//donothing
|
|
224
227
|
} else if (this.isAbsolute) {
|
|
225
|
-
window.open(this.url)
|
|
228
|
+
window.open(this.url);
|
|
226
229
|
} else {
|
|
227
|
-
this.$router.push(this.url)
|
|
230
|
+
this.$router.push(this.url);
|
|
228
231
|
}
|
|
229
|
-
this.$emit(
|
|
232
|
+
this.$emit("clicked");
|
|
230
233
|
},
|
|
231
234
|
},
|
|
232
|
-
}
|
|
235
|
+
};
|
|
233
236
|
</script>
|
|
234
237
|
<style lang="scss" scoped>
|
|
235
|
-
@import
|
|
238
|
+
@import "../../../includes/scss/all";
|
|
236
239
|
// styles can be found in global src/assets/styles/stylesheet.scss
|
|
237
240
|
// this is because rich text html can dynamically specify cta button class
|
|
238
241
|
.wcl-cta {
|
|
@@ -245,12 +248,12 @@ export default {
|
|
|
245
248
|
&--focus {
|
|
246
249
|
&-light {
|
|
247
250
|
&:focus {
|
|
248
|
-
@include focus-outline(
|
|
251
|
+
@include focus-outline("light");
|
|
249
252
|
}
|
|
250
253
|
}
|
|
251
254
|
&-dark {
|
|
252
255
|
&:focus {
|
|
253
|
-
@include focus-outline(
|
|
256
|
+
@include focus-outline("dark");
|
|
254
257
|
}
|
|
255
258
|
}
|
|
256
259
|
}
|