Skip to content

Commit

Permalink
feat: float filter button on mobile collection activity page
Browse files Browse the repository at this point in the history
  • Loading branch information
leo-anderson-x committed Apr 7, 2023
1 parent 6b2be2e commit 681e725
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
48 changes: 48 additions & 0 deletions components/explore/FilterFloatButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<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'
const route = useRoute()
const preferencesStore = usePreferencesStore()
const numOfActiveFilters = computed(() => {
const query = { ...route.query, redesign: undefined }
const activeFilters = Object.entries(query).filter(
([key, value]) => (key === 'search' && Boolean(value)) || value === 'true'
)
return activeFilters.length
})
const openMobileFilters = () => preferencesStore.setMobileFilterCollapse(true)
</script>

<style lang="scss" scoped>
@import '@/styles/abstracts/variables';
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>
4 changes: 3 additions & 1 deletion components/explore/MobileControls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<div class="explore is-flex is-flex-wrap-wrap">
<ExploreTabs />
<div class="explore-menu is-flex">
<FilterMenuButton />
<FilterMenuButton v-if="!isActivityTab" />
<FilterFloatButton v-if="isActivityTab" />
<ExploreOffer v-if="!isActivityTab" class="is-flex-grow-1" />
<ExploreChain
v-if="!route.name?.includes('prefix-collection-id')"
Expand All @@ -18,6 +19,7 @@ import ExploreSort from './ExploreSort.vue'
import ExploreChain from './ExploreChain.vue'
import ExploreOffer from './ExploreOffer.vue'
import FilterMenuButton from './FilterMenuButton.vue'
import FilterFloatButton from './FilterFloatButton.vue'
const route = useRoute()
Expand Down

0 comments on commit 681e725

Please sign in to comment.