From b55237e0f193a177422b1fc4d0e2fcb227751a56 Mon Sep 17 00:00:00 2001 From: Stephanie Smith Date: Sun, 15 Sep 2024 07:03:11 -0700 Subject: [PATCH] feature: edu resource subjects accordion filter group (#617) * adding dynamic slots to SearchFilterGroup * prepping for adding accordion to SearchFilterGroup * tweaking styles of accordion filters * more tweaks to styles * filter group accordion open if present in route.query * fixing accessibility test on SearchFilterGroup * spacing adjustments --- .../SearchFilterGroup.stories.js | 89 ++++++++ .../SearchFilterGroup/SearchFilterGroup.vue | 190 +++++++++++++++--- .../SearchFilterGroupAccordionItem.vue | 88 ++++++++ packages/vue/src/interfaces.ts | 21 ++ .../PageImageDetail/PageImageDetail.vue | 2 +- 5 files changed, 364 insertions(+), 26 deletions(-) create mode 100644 packages/vue/src/components/SearchFilterGroupAccordionItem/SearchFilterGroupAccordionItem.vue diff --git a/packages/vue/src/components/SearchFilterGroup/SearchFilterGroup.stories.js b/packages/vue/src/components/SearchFilterGroup/SearchFilterGroup.stories.js index 61c384ad..58454169 100644 --- a/packages/vue/src/components/SearchFilterGroup/SearchFilterGroup.stories.js +++ b/packages/vue/src/components/SearchFilterGroup/SearchFilterGroup.stories.js @@ -58,3 +58,92 @@ export const DateFilter = { truncateFilters: true } } +export const SubFilters = { + decorators: [ + () => ({ + template: '
' + }) + ], + args: { + filterBy: [], + buckets: [ + { key: 'Solar System', doc_count: 3308 }, + { key: 'Earth', doc_count: 1179 }, + { key: 'Stars and Galaxies', doc_count: 979 }, + { key: 'Technology', doc_count: 480 } + ], + groupKey: 'topics', + groupTitle: 'Topic', + truncateFilters: false, + subFilters: { + solar_system: [ + { + key: 'Sun', + agg: 'solar_system_area', + doc_count: 20 + }, + { + key: 'Mercury', + agg: 'solar_system_area', + doc_count: 21 + }, + { + key: 'Venus', + agg: 'solar_system_area', + doc_count: 22 + } + ], + earth: [ + { + key: 'Sea Level', + agg: 'solar_system_area', + doc_count: 20 + }, + { + key: 'Pollution', + agg: 'solar_system_area', + doc_count: 21 + }, + { + key: 'Climate Change', + agg: 'solar_system_area', + doc_count: 22 + } + ], + stars_and_galaxies: [ + { + key: 'Sea Level', + agg: 'solar_system_area', + doc_count: 20 + }, + { + key: 'Pollution', + agg: 'solar_system_area', + doc_count: 21 + }, + { + key: 'Climate Change', + agg: 'solar_system_area', + doc_count: 22 + } + ], + technology: [ + { + key: 'Sea Level', + agg: 'solar_system_area', + doc_count: 20 + }, + { + key: 'Pollution', + agg: 'solar_system_area', + doc_count: 21 + }, + { + key: 'Climate Change', + agg: 'solar_system_area', + doc_count: 22 + } + ] + } + } +} diff --git a/packages/vue/src/components/SearchFilterGroup/SearchFilterGroup.vue b/packages/vue/src/components/SearchFilterGroup/SearchFilterGroup.vue index 9f2efe40..657ed693 100644 --- a/packages/vue/src/components/SearchFilterGroup/SearchFilterGroup.vue +++ b/packages/vue/src/components/SearchFilterGroup/SearchFilterGroup.vue @@ -18,27 +18,98 @@ ref="buckets" class="form-group form-check" > - -
- - -
No matching filters
@@ -63,16 +134,28 @@ + + diff --git a/packages/vue/src/interfaces.ts b/packages/vue/src/interfaces.ts index e7416ad0..d3a3709b 100644 --- a/packages/vue/src/interfaces.ts +++ b/packages/vue/src/interfaces.ts @@ -185,6 +185,27 @@ export interface FooterResponse { footer: any } +export interface EDUSubjectArea { + id: number + primarySubject: EduResourcesSubject + subjectArea: string +} + +export interface SubFiltersObject { + [key: string]: { + parentBucketKey: string + aggParentKey: string + aggMapKey: string + subFilterKey: string + } +} + +export interface EduSubjectAreasResponse { + eduSubjectAreas: { + eduSubjectAreas: EDUSubjectArea[] + } +} + export type Explorer1Theme = 'defaultTheme' | 'ThemeInternal' | 'ThemeEdu' export interface Attributes { diff --git a/packages/vue/src/templates/PageImageDetail/PageImageDetail.vue b/packages/vue/src/templates/PageImageDetail/PageImageDetail.vue index 390fc02a..29198335 100755 --- a/packages/vue/src/templates/PageImageDetail/PageImageDetail.vue +++ b/packages/vue/src/templates/PageImageDetail/PageImageDetail.vue @@ -159,7 +159,7 @@ {{ item.target }}