-
Notifications
You must be signed in to change notification settings - Fork 317
/
ResultsTitle.vue
45 lines (42 loc) · 928 Bytes
/
ResultsTitle.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<template>
<p class="records-title" v-if="dataset.results.total > 0">
Records
<span v-if="showWhenFiltered && areFiltersApplied.length"
>with filters applied</span
>
({{ dataset.results.total | formatNumber }})
</p>
</template>
<script>
export default {
props: {
dataset: {
type: Object,
required: true,
},
showWhenFiltered: {
type: Boolean,
required: false,
},
excludedFilter: {
type: Array,
default: () => {
return ["text"];
},
},
},
computed: {
areFiltersApplied() {
const appliedFilters = Object.keys(this.dataset.query)
.filter((f) => !this.excludedFilter.includes(f))
.map((key) => this.dataset.query[key]);
return appliedFilters.filter((v) => v && Object.values(v).length);
},
},
};
</script>
<style lang="scss" scoped>
.records-title {
color: $font-secondary;
}
</style>