SearchGridFilter wrapper component selected based on reactive media query #445
Conversation
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.
Thanks for taking care of the reactivity, brilliant solution ✨
@@ -35,16 +31,31 @@ import { | |||
import { SET_FILTER_IS_VISIBLE } from '~/constants/mutation-types' | |||
import { queryStringToSearchType } from '~/utils/search-query-transform' | |||
import local from '~/utils/local' | |||
import { screenWidth } from '~/utils/get-browser-info' |
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.
It looks like we can delete this file, it is not used anywhere else.
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.
Great catch! Thank you for keeping the codebase clean and not leaving remains of the previous implementations in the repository :)
<Component | ||
:is="searchFilter.as" | ||
v-if="isFilterVisible" | ||
:class="searchFilter.classes" | ||
@close="onToggleSearchGridFilter" | ||
><SearchGridFilter | ||
/></Component> |
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.
What a perfect use for a dynamic component, nice!
I am going to merge this PR because it's a PR of a PR :) The main code review should go in #439 |
* SearchGridFilter wrapper component selected based on reactive media query (#445) * Make media query responsive * Improve comments and remove event listener on unmount * Remove unused file * Update search page unit tests * Address code style comments Co-authored-by: Olga Bulat <obulat@gmail.com>
Fixes
Related to #439 by @krysal
Description
This PR attempts to make the media query that determines which wrapper is used for SearchGridFilter reactive, and leave a single SearchGridFilter with unique ids.
It uses the code from
VueUse
library for a reactive media query composeable, and the code for correct disposal needs to be added. I wanted to use Vueuse directly, but it imports something from vue-demi, which doesn't work correctly with Nuxt composition API.Testing Instructions
Checkout the branch, open the filters and narrow the screen. The filter should change from an aside into a modal at around 738px screen width.
Checklist
Update index.md
).main
) or a parent feature branch.Developer Certificate of Origin
Developer Certificate of Origin