Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

SearchGridFilter wrapper component selected based on reactive media query #445

Merged
merged 3 commits into from Nov 25, 2021

Conversation

obulat
Copy link
Contributor

@obulat obulat commented Nov 23, 2021

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

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@obulat obulat requested a review from a team as a code owner November 23, 2021 17:46
@dhruvkb dhruvkb added this to Needs review in Openverse PRs Nov 23, 2021
@obulat obulat self-assigned this Nov 23, 2021
@obulat obulat added 🕹 aspect: interface Concerns end-users' experience with the software 🛠 goal: fix Bug fix 🟨 priority: medium Not blocking but should be addressed soon labels Nov 23, 2021
Copy link
Member

@krysal krysal left a 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'
Copy link
Member

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.

Copy link
Contributor Author

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 :)

Comment on lines +4 to +10
<Component
:is="searchFilter.as"
v-if="isFilterVisible"
:class="searchFilter.classes"
@close="onToggleSearchGridFilter"
><SearchGridFilter
/></Component>
Copy link
Member

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!

@obulat
Copy link
Contributor Author

obulat commented Nov 25, 2021

I am going to merge this PR because it's a PR of a PR :) The main code review should go in #439

@obulat obulat merged commit 095f734 into exclusive_searchgridfilter Nov 25, 2021
@obulat obulat deleted the responsive_media_query branch November 25, 2021 14:56
Openverse PRs automation moved this from Needs review to Merged! Nov 25, 2021
krysal added a commit that referenced this pull request Nov 29, 2021
* 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>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🕹 aspect: interface Concerns end-users' experience with the software 🛠 goal: fix Bug fix 🟨 priority: medium Not blocking but should be addressed soon
Projects
No open projects
Openverse PRs
  
Merged!
Development

Successfully merging this pull request may close these issues.

None yet

2 participants