-
Notifications
You must be signed in to change notification settings - Fork 5
feat: Creates FilterDropdown and RefineSearchPanel #845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- marks footer as already existing
| class="filter-option" | ||
| :class="{ 'is-selected': isOptionSelected(getFilterKey(filter), option.value) }" | ||
| > | ||
| <input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accessibility
wrap each filter options set in a
with a equal to the filter name. labels & checkboxes are already good.| <template #summary> | ||
| <div | ||
| class="filter-summary" | ||
| :class="{ 'is-filtered': filteredStates[getFilterKey(filter)] }" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can move that logic into a function:
function summaryClasses(filterKey) {
return {
'is-filtered': filteredStates.value[filterKey],
}
}
Then in your template:
<div :class="summaryClasses(getFilterKey(filter))">
...
</div>
| v-for="option in getFilterOptions(filter)" | ||
| :key="option.value" | ||
| class="filter-option" | ||
| :class="{ 'is-selected': isOptionSelected(getFilterKey(filter), option.value) }" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can move that logic into a function:
function optionClasses(filterKey: string, optionValue: string) {
return {
'is-selected': isOptionSelected(filterKey, optionValue),
}
}
Then in your template:
<label :class="optionClasses(getFilterKey(filter), option.value)">
|
|
||
| <!-- See All button as part of the transition group --> | ||
| <div | ||
| v-if="filter.showAll && (!hasSelectedOptions(getFilterKey(filter)) || !filteredStates[getFilterKey(filter)])" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function shouldShowSeeAll(filter: any){
const key = getFilterKey(filter)
return (
filter.showAll &&
(!hasSelectedOptions(key) || !filteredStates.value[key])
)
}
<div v-if="shouldShowSeeAll(filter)">
See All →
</div>
| @@ -0,0 +1,273 @@ | |||
| <script setup lang="ts"> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to make sure this component is usable not only for this phase of the project, but also 6–12 months from now by any developer on our team or yours. Right now the logic is powerful, but it’s hard for beginners to contribute or modify without risks. Simplifying naming and structure would make the component easier to maintain long-term.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clear naming reduces misunderstanding and prevents regression bugs.
Simple 1–2 line comments above each reactive state or function will help future developers understand the intent quickly.
Adds comments to clarify the component much more.
Component Created: FilterDropdown.vue
Component Created: RefineSearchPanel.vue
Component Created: EffectSlideToggle.vue
Stories: ~/stories/FilterDropdown.stories.js
Stories: ~/stories/RefineSearchPanel.stories.js
Stories: ~/stories/EffectSlideToggle.stories.js
Spec: ~/stories/FilterDropdownspec.js
Spec: ~/stories/RefineSearchPanel.js
Spec: ~/stories/EffectSlideToggle.js
Designs:
https://www.figma.com/design/CDhWDARLb36ftkQce1LyLC/Breakpoints?node-id=1-25&m=dev
https://www.figma.com/design/CDhWDARLb36ftkQce1LyLC/Breakpoints?node-id=1-26&p=f&m=dev
Read in Recording:
https://drive.google.com/file/d/17tiGmE4aax-faoo5Rjue2Idbx3OGCFGa/view?usp=sharing
Relevant Links
https://www.library.ucla.edu/
https://digital.library.ucla.edu/catalog/ark:/21198/z1x98m6j
Notes:




Checklist:
library-website-nuxt dev server