Addons store: Use swiper for addon cards on mobile & Reduce size of addon card on desktop (#2216)
Fixes #2205 and fixes #1668. This slighly reduces the addon card size on desktop and uses a swiper (like in many app stores) instead of a flex on mobile. Signed-off-by: Florian Hotze <dev@florianhotze.com>pull/2833/head
parent
dad104e5d7
commit
574c313fde
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<f7-link v-if="addon" class="addon-card padding-right-half" :href="`/addons/${addon.type}/${addon.uid}`">
|
<f7-link v-if="addon" class="addon-card" :href="`/addons/${addon.type}/${addon.uid}`">
|
||||||
<div class="addon-card-inner card">
|
<div class="addon-card-inner card">
|
||||||
<div class="addon-card-headline">
|
<div class="addon-card-headline">
|
||||||
<div>{{ headline || autoHeadline || " " }}</div>
|
<div>{{ headline || autoHeadline || " " }}</div>
|
||||||
|
@ -32,19 +32,19 @@
|
||||||
|
|
||||||
<style lang="stylus">
|
<style lang="stylus">
|
||||||
.addon-card
|
.addon-card
|
||||||
padding 5px
|
width 100%
|
||||||
width: 100%
|
|
||||||
position relative
|
position relative
|
||||||
|
|
||||||
.addon-card-inner
|
.addon-card-inner
|
||||||
width 100%
|
width 100%
|
||||||
height 100%
|
height 100%
|
||||||
margin: 0px
|
margin 0
|
||||||
display flex
|
display flex
|
||||||
flex-direction column
|
flex-direction column
|
||||||
scroll-snap-align center center
|
scroll-snap-align center center
|
||||||
padding 10px
|
padding 10px
|
||||||
border-radius 5px
|
border-radius 5px
|
||||||
|
box-sizing border-box
|
||||||
|
|
||||||
&:hover
|
&:hover
|
||||||
background var(--f7-list-link-hover-bg-color)
|
background var(--f7-list-link-hover-bg-color)
|
||||||
|
@ -66,8 +66,6 @@
|
||||||
text-overflow ellipsis
|
text-overflow ellipsis
|
||||||
overflow clip
|
overflow clip
|
||||||
white-space nowrap
|
white-space nowrap
|
||||||
// width calc(100% - 5rem)
|
|
||||||
width 210px
|
|
||||||
color var(--f7-text-color)
|
color var(--f7-text-color)
|
||||||
.addon-card-title-after
|
.addon-card-title-after
|
||||||
.preloader-inner .preloader-inner-left, .preloader-inner .preloader-inner-right, .preloader-inner .preloader-inner-line
|
.preloader-inner .preloader-inner-left, .preloader-inner .preloader-inner-right, .preloader-inner .preloader-inner-line
|
||||||
|
|
|
@ -9,15 +9,24 @@
|
||||||
<f7-block-footer v-if="subtitle">
|
<f7-block-footer v-if="subtitle">
|
||||||
{{ subtitle }}
|
{{ subtitle }}
|
||||||
</f7-block-footer>
|
</f7-block-footer>
|
||||||
<div class="addons-cards">
|
<template v-if="featuredAddons?.length > 0">
|
||||||
<addon-card v-for="addon in featuredAddons" :key="addon.uid" :addon="addon" :install-action-text="installActionText" :headline="'Featured'" @addonButtonClick="addonButtonClick" />
|
<addons-swiper v-if="!$device.desktop" :addons-list="featuredAddons" :install-action-text="installActionText" :headline="'Featured'" @addonButtonClick="addonButtonClick" />
|
||||||
</div>
|
<div v-else class="addons-cards">
|
||||||
<div v-if="suggested" class="addons-cards">
|
<addon-card class="addon-card-desktop" v-for="addon in featuredAddons" :key="addon.uid" :addon="addon" :install-action-text="installActionText" :headline="'Featured'" @addonButtonClick="addonButtonClick" />
|
||||||
<addon-card v-for="addon in addonsList" :key="addon.uid" :addon="addon" :install-action-text="installActionText" :headline="'Suggested'" @addonButtonClick="addonButtonClick" />
|
</div>
|
||||||
</div>
|
</template>
|
||||||
<div v-else-if="showAsCards" class="addons-cards">
|
<template v-if="suggested">
|
||||||
<addon-card v-for="addon in addonsList" :key="addon.uid" :addon="addon" :install-action-text="installActionText" @addonButtonClick="addonButtonClick" />
|
<addons-swiper v-if="!$device.desktop" :addons-list="addonsList" :install-action-text="installActionText" :headline="'Suggested'" @addonButtonClick="addonButtonClick" />
|
||||||
</div>
|
<div v-else class="addons-cards">
|
||||||
|
<addon-card class="addon-card-desktop" v-for="addon in addonsList" :key="addon.uid" :addon="addon" :install-action-text="installActionText" :headline="'Suggested'" @addonButtonClick="addonButtonClick" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="showAsCards">
|
||||||
|
<addons-swiper v-if="!$device.desktop && !canExpand" :addons-list="addonsList" :install-action-text="installActionText" @addonButtonClick="addonButtonClick" />
|
||||||
|
<div v-else class="addons-cards">
|
||||||
|
<addon-card class="addon-card-desktop" v-for="addon in addonsList" :key="addon.uid" :addon="addon" :install-action-text="installActionText" @addonButtonClick="addonButtonClick" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
<f7-list v-else media-list ref="addonlist" class="addons-table-list" no-chevron no-hairlines>
|
<f7-list v-else media-list ref="addonlist" class="addons-table-list" no-chevron no-hairlines>
|
||||||
<addon-list-item v-for="addon in addonsList" :key="addon.uid" :addon="addon" :install-action-text="installActionText" @addonButtonClick="addonButtonClick" />
|
<addon-list-item v-for="addon in addonsList" :key="addon.uid" :addon="addon" :install-action-text="installActionText" @addonButtonClick="addonButtonClick" />
|
||||||
</f7-list>
|
</f7-list>
|
||||||
|
@ -70,36 +79,40 @@
|
||||||
width 33.333%
|
width 33.333%
|
||||||
@media (min-width 1601px)
|
@media (min-width 1601px)
|
||||||
width 25%
|
width 25%
|
||||||
|
.addons-swiper
|
||||||
|
margin-top 1rem
|
||||||
.addons-cards
|
.addons-cards
|
||||||
margin-top 1rem
|
margin-top 1rem
|
||||||
display flex
|
display flex
|
||||||
flex-shrink 0
|
|
||||||
flex-direction row
|
flex-direction row
|
||||||
align-content flex-start
|
align-content flex-start
|
||||||
align-items flex-end
|
align-items flex-end
|
||||||
flex-wrap wrap
|
flex-wrap wrap
|
||||||
// gap 0.5rem
|
gap 10px
|
||||||
padding-left var(--f7-safe-area-left)
|
.addon-card-desktop
|
||||||
.addon-card
|
|
||||||
width 100%
|
width 100%
|
||||||
@media (min-width: 481px)
|
@media (min-width: 450px)
|
||||||
width 50%
|
width calc(50% - 10px)
|
||||||
@media (min-width: 768px)
|
@media (min-width: 600px)
|
||||||
width 33.333%
|
width calc(33.333% - 10px)
|
||||||
@media (min-width: 1281px)
|
@media (min-width: 800px)
|
||||||
width 25%
|
width calc(25% - 10px)
|
||||||
@media (min-width: 1601px)
|
@media (min-width: 1250px)
|
||||||
width 20%
|
width calc(20% - 10px)
|
||||||
|
@media (min-width: 1600px)
|
||||||
|
width: calc(16.667% - 10px)
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import AddonListItem from './addon-list-item.vue'
|
import AddonListItem from './addon-list-item.vue'
|
||||||
import AddonCard from './addon-card.vue'
|
import AddonCard from './addon-card.vue'
|
||||||
import { compareAddons } from '@/assets/addon-store'
|
import { compareAddons } from '@/assets/addon-store'
|
||||||
|
import AddonsSwiper from '@/components/addons/addons-swiper.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['addons', 'title', 'subtitle', 'showAll', 'featured', 'showAsCards', 'suggested', 'installActionText'],
|
props: ['addons', 'title', 'subtitle', 'showAll', 'featured', 'showAsCards', 'suggested', 'installActionText'],
|
||||||
components: {
|
components: {
|
||||||
|
AddonsSwiper,
|
||||||
AddonListItem,
|
AddonListItem,
|
||||||
AddonCard
|
AddonCard
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
<template>
|
||||||
|
<addon-card class="addons-swiper" v-if="addonsList.length === 1" style="width: 66.667%" :addon="addonsList[0]" :install-action-text="installActionText" :headline="headline" @addonButtonClick="addonButtonClick" />
|
||||||
|
<f7-swiper class="addons-swiper" v-else pagination :params="{ spaceBetween: 10, slidesPerView: 1.5 }">
|
||||||
|
<f7-swiper-slide v-for="addon in addonsList" :key="addon.uid">
|
||||||
|
<addon-card :key="addon.uid" :addon="addon" :install-action-text="installActionText" :headline="headline" @addonButtonClick="addonButtonClick" />
|
||||||
|
</f7-swiper-slide>
|
||||||
|
</f7-swiper>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import AddonCard from '@/components/addons/addon-card.vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: ['addonsList', 'installActionText', 'headline'],
|
||||||
|
emits: ['addonButtonClick'],
|
||||||
|
components: {
|
||||||
|
AddonCard
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
addonButtonClick (addon) {
|
||||||
|
this.$emit('addonButtonClick', addon)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Reference in New Issue