@worksafevictoria/wcl7.5 1.1.0-beta.3 → 1.1.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.
@@ -1,32 +1,22 @@
1
1
  <template>
2
2
  <div class="app-search-result">
3
- <div v-if="isLoading" class="app-search-result__loader"></div>
3
+ <div v-if="isLoading" class="app-search-result__loader" ></div>
4
4
  <p
5
5
  v-if="!(isTypeahead && numFound > 0) && !isLoading"
6
6
  class="app-search-result__found"
7
7
  >
8
- <span
9
- >{{ numFound }} results found for
10
- {{ !suggestion ? query : suggestion }}</span
11
- >
12
- </p>
13
- <p
14
- v-if="results && results.length > 0 && suggestion"
15
- class="app-search-result__suggestion"
16
- >
17
- Showing results for <span class="suggestion">{{ suggestion }}</span>
8
+ <span>{{ numFound }} results found for {{ query }}</span>
18
9
  </p>
19
10
  <card-grid
20
11
  v-if="results && results.length > 0 && !isLoading"
21
12
  :force-lg-columns-per-row="1"
22
13
  :force-md-columns-per-row="1"
23
14
  :cards="results"
24
- :is-selectable="false"
15
+ :is-selectable="true"
25
16
  :size="'full'"
26
17
  :row-spacing="'none'"
27
18
  :no-padding-top="true"
28
19
  @selected="onSelectResult"
29
- @selected-title="onSelectCardTitle"
30
20
  >
31
21
  <template v-slot:cardItem="{ card }">
32
22
  <card-grid-item
@@ -39,7 +29,7 @@
39
29
  :description="
40
30
  !isTypeahead && card.description
41
31
  ? truncate(card.description, 144)
42
- : card.htmlSnippet || ''
32
+ : ''
43
33
  "
44
34
  :strip-description-html="true"
45
35
  :taxonomies="{
@@ -47,7 +37,6 @@
47
37
  topic: card.topic,
48
38
  language: card.language
49
39
  }"
50
- :is-card-title-selectable="isCardTitleSelectable"
51
40
  />
52
41
  </template>
53
42
  <template
@@ -69,6 +58,7 @@
69
58
  :aria-label="'search result pagination'"
70
59
  :rows="pageLimit"
71
60
  :offset="offset"
61
+ :max-pages="4"
72
62
  :total="numFound"
73
63
  :align="'start'"
74
64
  @prev="(pg) => $emit('pageChanged', pg.currentPage)"
@@ -123,14 +113,6 @@ export default {
123
113
  isLoading: {
124
114
  type: Boolean,
125
115
  required: false
126
- },
127
- suggestion: {
128
- type: String,
129
- default: null
130
- },
131
- isCardTitleSelectable: {
132
- type: Boolean,
133
- default: false
134
116
  }
135
117
  },
136
118
  methods: {
@@ -143,18 +125,6 @@ export default {
143
125
  }
144
126
  return value
145
127
  },
146
- onSelectCardTitle(card) {
147
- navigateToPath.call(
148
- this,
149
- card?.selectedCard?.link,
150
- card?.ev?.ctrlKey === true || card?.ev?.metaKey === true
151
- )
152
- this.$nextTick(() => this.$emit('selected-title'))
153
-
154
- if (this.$gtm) {
155
- this.fireGTM(card)
156
- }
157
- },
158
128
  onSelectResult(card) {
159
129
  navigateToPath.call(
160
130
  this,
@@ -162,12 +132,6 @@ export default {
162
132
  card?.ev?.ctrlKey === true || card?.ev?.metaKey === true
163
133
  )
164
134
  this.$nextTick(() => this.$emit('selected'))
165
-
166
- if (this.$gtm) {
167
- this.fireGTM(card)
168
- }
169
- },
170
- fireGTM(card) {
171
135
  let attrs = {
172
136
  location:
173
137
  this.$route?.path === '/'
@@ -185,7 +149,9 @@ export default {
185
149
  topic: card?.selectedCard?.topic,
186
150
  language: card?.selectedCard?.language
187
151
  }
188
- this.$gtm.push({ event: 'custom.search.site.result', ...attrs })
152
+ if (this.$gtm) {
153
+ this.$gtm.push({ event: 'custom.search.site.result', ...attrs })
154
+ }
189
155
  },
190
156
  showMoreResults() {
191
157
  if (this.$nuxt) {
@@ -199,13 +165,8 @@ export default {
199
165
  <style lang="scss" scoped>
200
166
  @import '../../../../includes/scss/all';
201
167
  .app-search-result {
202
- &__found,
203
- &__suggestion {
168
+ &__found {
204
169
  margin: 40px 16px;
205
- .suggestion {
206
- font-weight: bold;
207
- color: #006bff;
208
- }
209
170
  }
210
171
 
211
172
  :deep(.card-grid-item__card) {
@@ -253,25 +214,4 @@ export default {
253
214
  }
254
215
  }
255
216
  }
256
-
257
- .wcl-search__google {
258
- .app-search-result {
259
- :deep(.card-grid-item__card) {
260
- border-radius: 0 !important;
261
- border-bottom: solid $gray-alt 1px;
262
- &:hover {
263
- background-color: transparent !important;
264
- }
265
- }
266
- :deep(.card-title) {
267
- text-decoration: underline;
268
- border: 3px solid transparent;
269
- width: auto;
270
- &:hover {
271
- border: 3px solid #da47ff;
272
- color: #006bff !important;
273
- }
274
- }
275
- }
276
- }
277
217
  </style>
@@ -15,32 +15,29 @@ const contentParser = () => {
15
15
 
16
16
  export default {
17
17
  title: 'SubComponents/Search',
18
- component: { Search },
19
- tags: ['autodocs'],
18
+ component: Search,
20
19
  argTypes: {
20
+ pageLimit: {
21
+ control: 'number'
22
+ },
21
23
  contentParser: {
24
+ control: 'function',
22
25
  table: { disable: true }
26
+ },
27
+ isTypeahead: {
28
+ control: 'boolean'
29
+ },
30
+ initialSearchQuery: {
31
+ control: 'text'
23
32
  }
24
- },
33
+ }
34
+ }
35
+
36
+ export const Default = {
25
37
  args: {
26
38
  pageLimit: 5,
27
39
  contentParser: contentParser,
28
40
  isTypeahead: false,
29
- initialSearchQuery: 'Metal',
30
- googleSearchFlag: 'solar',
31
- visibleSearchList: true
41
+ initialSearchQuery: 'Metal'
32
42
  }
33
43
  }
34
-
35
- const DefaultSearch = (args) => ({
36
- components: { Search },
37
- setup () {
38
- return { args }
39
- },
40
- template: `<search
41
- v-bind="args"
42
- ref="solrsearch" />`
43
- })
44
-
45
- export const Default = DefaultSearch.bind({})
46
-