diff --git a/src/components/VHeader/VFilterButton.vue b/src/components/VHeader/VFilterButton.vue
index 33f9e55243..54bfab58a4 100644
--- a/src/components/VHeader/VFilterButton.vue
+++ b/src/components/VHeader/VFilterButton.vue
@@ -1,25 +1,25 @@
-
- {{ xlMinLabel }}
- {{
- lgMaxLabel
- }}
+ {{ textLabel }}
@@ -31,14 +31,12 @@ import { defineEvent } from "~/types/emits"
import { useI18n } from "~/composables/use-i18n"
import VButton from "~/components/VButton.vue"
-import VIcon from "~/components/VIcon/VIcon.vue"
-
-import filterIcon from "~/assets/icons/filter.svg"
+import VFilterIconOrCounter from "~/components/VHeader/VFilterIconOrCounter.vue"
export default defineComponent({
name: "VFilterButton",
components: {
- VIcon,
+ VFilterIconOrCounter,
VButton,
},
props: {
@@ -52,7 +50,6 @@ export default defineComponent({
},
},
emits: {
- tab: defineEvent<[KeyboardEvent]>(),
toggle: defineEvent(),
},
setup() {
@@ -61,26 +58,16 @@ export default defineComponent({
const filterCount = computed(() => searchStore.appliedFilterCount)
const filtersAreApplied = computed(() => filterCount.value > 0)
- /**
- * This label's verbosity makes it useful for the aria-label
- * where it is also used, especially on mobile where the
- * label would just be the number of applied filters, and therefore
- * basically useless as far as a label is concerned!
- */
- const xlMinLabel = computed(() =>
- filtersAreApplied.value
- ? i18n.tc("header.filter-button.with-count", filterCount.value)
- : i18n.t("header.filter-button.simple")
- )
- const lgMaxLabel = computed(() =>
- filtersAreApplied ? filterCount.value : ""
+ const textLabel = computed(() => i18n.t("header.filter-button.simple"))
+ const ariaLabel = computed(() =>
+ i18n.tc("header.filter-button.with-count", filterCount.value)
)
return {
- filterIcon,
- xlMinLabel,
- lgMaxLabel,
+ ariaLabel,
+ textLabel,
filtersAreApplied,
+ filterCount,
}
},
})
diff --git a/src/components/VHeader/VFilterIconOrCounter.vue b/src/components/VHeader/VFilterIconOrCounter.vue
new file mode 100644
index 0000000000..c2e3ea74b2
--- /dev/null
+++ b/src/components/VHeader/VFilterIconOrCounter.vue
@@ -0,0 +1,40 @@
+
+
+
+ {{ appliedFilterCount }}
+
+
+
diff --git a/src/components/VHeader/VHeaderMobile/VContentSettingsModalContent.vue b/src/components/VHeader/VHeaderMobile/VContentSettingsModalContent.vue
index c7cfb82d43..781a35fab9 100644
--- a/src/components/VHeader/VHeaderMobile/VContentSettingsModalContent.vue
+++ b/src/components/VHeader/VHeaderMobile/VContentSettingsModalContent.vue
@@ -38,7 +38,9 @@
size="medium"
class="label-regular gap-x-2"
>
- {{ $t("filters.title") }}{{
+ $t("filters.title")
+ }}
export const Template = (args, { argTypes }) => ({
- template: ``,
+ template: `
+
+
`,
components: { VFilterButton },
props: Object.keys(argTypes),
setup() {
@@ -67,8 +69,7 @@ export const Template = (args, { argTypes }) => ({
The button opens and closes the filters sidebar. It also shows how many filters
-are applied in the mobile view. the field receives an input. It also emits the
-`search` event when the search button is clicked.
+are applied. It also emits the `toggle` event when clicked.