forked from kodadot/nft-gallery
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request kodadot#5546 from leo-anderson-x/5359
feat: float filter button on mobile collection activity page
- Loading branch information
Showing
6 changed files
with
80 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<template> | ||
<div class="fixed-bottom-middle has-min-width"> | ||
<NeoButton expanded @click.native="openMobileFilters"> | ||
{{ $t('general.filters') | ||
}}<span v-if="numOfActiveFilters">: {{ numOfActiveFilters }}</span> | ||
</NeoButton> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { NeoButton } from '@kodadot1/brick' | ||
import { usePreferencesStore } from '@/stores/preferences' | ||
import useActiveRouterFilters from '@/composables/useActiveRouterFilters' | ||
const preferencesStore = usePreferencesStore() | ||
const activeFilters = useActiveRouterFilters() | ||
const numOfActiveFilters = computed( | ||
() => Object.keys(activeFilters.value).length | ||
) | ||
const openMobileFilters = () => preferencesStore.setMobileFilterCollapse(true) | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
a.disabled { | ||
opacity: 0.3; | ||
cursor: not-allowed; | ||
pointer-events: none; | ||
} | ||
.fixed-bottom-middle { | ||
position: fixed; | ||
bottom: 24px; | ||
left: 50%; | ||
transform: translateX(-50%); | ||
z-index: 1; | ||
} | ||
.has-min-width { | ||
min-width: 134px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export default function useActiveRouterFilters() { | ||
const route = useRoute() | ||
const activeFilters = computed(() => { | ||
const query = { ...route.query, redesign: undefined } | ||
type QueryValue = string | undefined | ||
const entries = Object.entries<QueryValue>(query).filter( | ||
([key, value]) => | ||
(key === 'search' && Boolean(value)) || | ||
(key === 'min' && value) || | ||
(key === 'max' && value) || | ||
value === 'true' | ||
) | ||
return Object.fromEntries(entries) | ||
}) | ||
|
||
return activeFilters | ||
} |