Popover when image pressed.

This commit is contained in:
2019-02-12 22:33:19 +01:00
parent 3fe1aeded1
commit 6e0c4ff5b5
10 changed files with 138 additions and 29 deletions

View File

@@ -10,7 +10,10 @@
export default { export default {
props: { props: {
longList: Boolean, short: {
default: true,
type: Boolean
}
}, },
data() { data() {
return { return {

View File

@@ -132,7 +132,6 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.parent { .parent {
display: block; display: block;
margin: 4rem 1rem; margin: 4rem 1rem;
} }
@@ -151,6 +150,7 @@ export default {
line-height: 22.399999618530273px; line-height: 22.399999618530273px;
padding-right: 0px; padding-right: 0px;
width: 100%; width: 100%;
max-width: 612px;
} }
.cont2 { .cont2 {
@@ -246,7 +246,8 @@ export default {
width: 290.9375px; width: 290.9375px;
@media screen and (max-width: 650px) { @media screen and (max-width: 650px) {
width: 40vw; max-width: 40vw;
min-width: 120px;
} }
&:last-of-type { &:last-of-type {

View File

@@ -1,4 +1,5 @@
<template> <template>
<div>
<div class="gallery"> <div class="gallery">
<div class="gallery--header"> <div class="gallery--header">
<h1>Topptur til gaustadtoppen æøå {{ id }}</h1> <h1>Topptur til gaustadtoppen æøå {{ id }}</h1>
@@ -9,7 +10,8 @@
<!-- <map-view :cords="cords"></map-view> --> <!-- <map-view :cords="cords"></map-view> -->
<!-- <calendar></calendar> --> <!-- <calendar></calendar> -->
<gallery></gallery> <gallery :short="false"></gallery>
</div>
</div> </div>
</template> </template>
@@ -48,8 +50,15 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.popover {
width: 100%;
height: 100vh;
position: absolute;
background-color: rgba(0,0,0,0.7);
}
.gallery { .gallery {
margin: 2.1rem; padding: 2.1rem;
&--header { &--header {
padding-bottom: 4rem; padding-bottom: 4rem;

View File

@@ -1,5 +1,6 @@
<template> <template>
<div class="gallery-container"> <div class="gallery-container">
<div v-for="item in gallery"> <div v-for="item in gallery">
<gallery-image v-if="item.type === 'image'" :image="item"></gallery-image> <gallery-image v-if="item.type === 'image'" :image="item"></gallery-image>
<gallery-text v-if="item.type === 'text'" :text="item"></gallery-text> <gallery-text v-if="item.type === 'text'" :text="item"></gallery-text>
@@ -14,6 +15,12 @@ import GalleryText from '@/components/GalleryText'
export default { export default {
name: 'Gallery-Item', name: 'Gallery-Item',
components: { GalleryImage, GalleryText }, components: { GalleryImage, GalleryText },
props: {
short: {
default: false,
type: Boolean
}
},
data() { data() {
return { return {
gallery: [ gallery: [
@@ -32,11 +39,11 @@ export default {
name: 'Nice jacket', name: 'Nice jacket',
url: 'https://static1.squarespace.com/static/585040955016e131e74667b0/5a4eeae7ec212d38915e64cd/5a4eeae8ec212d38915e64d2/1515121386336/The-Marias-Art-3.jpg?format=500w' url: 'https://static1.squarespace.com/static/585040955016e131e74667b0/5a4eeae7ec212d38915e64cd/5a4eeae8ec212d38915e64d2/1515121386336/The-Marias-Art-3.jpg?format=500w'
}, },
{ // {
type: 'text', // type: 'text',
title: 'title', // title: 'title',
subtext: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodoconsequat. Duis aute irure dolor in reprehenderit in voluptate velit essecillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat nonproident, sunt in culpa qui officia deserunt mollit anim id est laborum.' // subtext: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodoconsequat. Duis aute irure dolor in reprehenderit in voluptate velit essecillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat nonproident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
}, // },
{ {
type: 'image', type: 'image',
name: 'plants 4 life', name: 'plants 4 life',
@@ -61,7 +68,7 @@ export default {
display: flex; display: flex;
width: 100%; width: 100%;
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-evenly;
flex-wrap: wrap; flex-wrap: wrap;
} }

View File

@@ -19,13 +19,14 @@ export default {
}, },
data() { data() {
return { return {
} }
}, },
created() {}, created() {},
beforeMount() {}, beforeMount() {},
methods: { methods: {
popOver(image) {
eventHub.$emit('openPopover', image);
}
} }
} }
</script> </script>
@@ -34,6 +35,7 @@ export default {
img { img {
height: 300px; height: 300px;
cursor: pointer; cursor: pointer;
margin: 0 0.5rem;
@media screen and (max-width: 600px) { @media screen and (max-width: 600px) {
background-color: red; background-color: red;

View File

@@ -1,10 +1,15 @@
<template> <template>
<div class="site-header"> <div>
<!-- <div class="site-header"></div> -->
<!-- <h1>{{ title }}</h1> <!-- <h1>{{ title }}</h1>
<h2>Han har ikke hatt nok etter 60 år!</h2> <h2>Han har ikke hatt nok etter 60 år!</h2>
{{ date }} --> {{ date }} -->
<!-- <Header></Header> --> <!-- <Header></Header> -->
<router-link to="edit">Edit Page</router-link>
<!-- <router-link to="edit">Edit Page</router-link> -->
<Popover class="popup" v-if="popoverShow" :image="popoverImage"></Popover>
<event-page></event-page> <event-page></event-page>
</div> </div>
@@ -13,20 +18,32 @@
<script> <script>
import Header from '@/components/Header' import Header from '@/components/Header'
import EventPage from '@/components/EventPage' import EventPage from '@/components/EventPage'
import Popover from '@/components/Popover'
export default { export default {
components: { Header, EventPage }, components: { Header, EventPage, Popover },
data() { data() {
return { return {
title: 'Leifs opplevelser', title: 'Leifs opplevelser',
date: undefined, date: undefined,
bool: false bool: false,
popoverImage: undefined,
popoverShow: false
} }
}, },
created() { created() {
this.date = new Date(); this.date = new Date();
eventHub.$on('openPopover', this.openPopover)
eventHub.$on('closePopover', this.closePopover)
}, },
methods: { methods: {
openPopover(image) {
this.popoverImage = image;
this.popoverShow = true;
},
closePopover(image) {
this.popoverShow = false;
},
navigate: function() { navigate: function() {
console.log(this.$router) console.log(this.$router)
this.$router.push('/edit'); this.$router.push('/edit');

View File

@@ -0,0 +1,69 @@
<template>
<div class="popover" @click="close">
<div class="image-container">
<img @click="close" :src="image.url" />
</div>
</div>
</template>
<script>
export default {
components: {
},
props: {
image: {
type: Object,
required: true,
}
},
data() {
return {
}
},
created() {},
beforeMount() {},
methods: {
close() {
eventHub.$emit('closePopover')
}
}
}
</script>
<style lang="scss" scoped>
.popover {
height: 100%;
width: 100%;
position: absolute;
background-color: rgba(0,0,0,0.7);
display: flex;
align-items: center;
justify-content: center;
img {
max-height: 80%;
}
.hover-options {
position: relative;
background-color: rgba(0,0,0,0.4);
font-family: 'Proxima Nova Bold';
font-weight: 600;
width: calc(100% - 2rem);
padding: 0.6rem 1rem;
margin-top: -38px;
z-index: 3;
span {
cursor: pointer;
padding: 0.1rem 0.2rem;
}
span:not(:first-child) {
margin-left: 2rem;
}
}
}
</style>

View File

@@ -6,9 +6,10 @@ import router from './routes'
import axios from 'axios' import axios from 'axios'
import BootstrapVue from 'bootstrap-vue' import BootstrapVue from 'bootstrap-vue'
Vue.config.productionTip = false Vue.config.productionTip = false
window.eventHub = new Vue();
new Vue({ new Vue({
el: '#app', el: '#app',
axios, axios,

View File

@@ -24,7 +24,7 @@ let routes = [
name: 'Calendar', name: 'Calendar',
path: '/calendar', path: '/calendar',
props: { props: {
default: { longList: true }, default: { short: false },
}, },
components: require('@/components/Calendar') components: require('@/components/Calendar')
}, },

View File

@@ -11,7 +11,7 @@
} }
@font-face { @font-face {
font-family: "Proxima-cocker"; font-family: "Proxima Nova Bold";
src: url("assets/fonts/nova.ttf"); src: url("assets/fonts/nova.ttf");
} }