Added carousel with proper sizing to homepage

pull/16/head
Nikan Dalvand 2019-07-24 18:31:18 +04:30
parent 0b101a771e
commit cad77d3751
2 changed files with 49 additions and 6 deletions

View File

@ -44,7 +44,7 @@ $lato-font-path: '/node_modules/lato-font/fonts'
.page .page
flex-grow: 1 flex-grow: 1
overflow: auto overflow-x: hidden
transition: padding-top 300ms transition: padding-top 300ms
@media(max-width: 800px) @media(max-width: 800px)
.page .page

View File

@ -1,8 +1,12 @@
<template> <template>
<section class="page"> <section>
<ActionBar /> <ActionBar />
<div> <div>
<MusicBox v-for="item in top" :key="item.id" :item="item" /> <Carousel class="carousel-custom" :paginationEnabled="false" :scrollPerPage="false" :perPageCustom="[[300, 2], [540, 3], [740, 4], [800, 3], [900, 4], [1000, 4], [1200, 5]]">
<Slide v-for="item in top" :key="item.id">
<MusicBox :item="item" />
</Slide>
</Carousel>
</div> </div>
</section> </section>
</template> </template>
@ -10,9 +14,10 @@
<script> <script>
import ActionBar from './ActionBar' import ActionBar from './ActionBar'
import MusicBox from '../components/MusicBox' import MusicBox from '../components/MusicBox'
import { Carousel, Slide } from 'vue-carousel'
export default { export default {
name: 'HomePage', name: 'HomePage',
components: { ActionBar, MusicBox }, components: { ActionBar, MusicBox, Carousel, Slide },
data: () => { data: () => {
return { return {
top: [ top: [
@ -33,6 +38,42 @@ export default {
title: 'Tilte', title: 'Tilte',
artist: 'Juice WRLD', artist: 'Juice WRLD',
artwork: '/static/demo/clever.jpg' artwork: '/static/demo/clever.jpg'
},
{
id: 3,
title: 'Habiba',
artist: 'Oldasinus',
artwork: '/static/demo/habiba.jpg'
},
{
id: 4,
title: 'Starboy',
artist: 'The Weeknd',
artwork: '/static/demo/starboy.png'
},
{
id: 5,
title: 'Tilte',
artist: 'Juice WRLD',
artwork: '/static/demo/clever.jpg'
},
{
id: 6,
title: 'Habiba',
artist: 'Oldasinus',
artwork: '/static/demo/habiba.jpg'
},
{
id: 7,
title: 'Starboy',
artist: 'The Weeknd',
artwork: '/static/demo/starboy.png'
},
{
id: 8,
title: 'Tilte',
artist: 'Juice WRLD',
artwork: '/static/demo/clever.jpg'
} }
] ]
} }
@ -40,8 +81,10 @@ export default {
} }
</script> </script>
<style scoped lang="sass"> <style lang="sass">
section.page section.page
padding: 1rem 2.5rem padding: 1rem 2.5rem
overflow-x: hidden
.VueCarousel-wrapper
overflow: unset
</style> </style>