Add full screen infographic component

This commit is contained in:
Ramon Wenger 2019-02-20 16:12:16 +01:00
parent 0d99019e94
commit 32f2ddaea5
5 changed files with 63 additions and 3 deletions

View File

@ -18,6 +18,7 @@
import EditObjectiveGroupWizard from '@/components/objective-groups/EditObjectiveGroupWizard'; import EditObjectiveGroupWizard from '@/components/objective-groups/EditObjectiveGroupWizard';
import NewProjectEntryWizard from '@/components/portfolio/NewProjectEntryWizard'; import NewProjectEntryWizard from '@/components/portfolio/NewProjectEntryWizard';
import FullscreenImage from '@/components/FullscreenImage'; import FullscreenImage from '@/components/FullscreenImage';
import FullscreenInfographic from '@/components/FullscreenInfographic';
export default { export default {
name: 'App', name: 'App',
@ -34,7 +35,8 @@
NewObjectiveGroupWizard, NewObjectiveGroupWizard,
EditObjectiveGroupWizard, EditObjectiveGroupWizard,
NewProjectEntryWizard, NewProjectEntryWizard,
FullscreenImage FullscreenImage,
FullscreenInfographic
}, },
computed: { computed: {

View File

@ -0,0 +1,31 @@
<template>
<modal :fullscreen="true">
<component :is="type" :value="value"></component>
</modal>
</template>
<script>
import Modal from '@/components/Modal';
import InfogramBlock from '@/components/content-blocks/InfogramBlock';
export default {
components: {
Modal,
InfogramBlock
},
computed: {
id() {
return this.$store.state.infographic.id;
},
type() {
return this.$store.state.infographic.type;
},
value() {
return {
id: this.id
}
}
}
}
</script>

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="modal__backdrop"> <div class="modal__backdrop">
<div class="modal" :class="{'modal--hide-header': hideHeader, 'modal--fullscreen': fullscreen}"> <div class="modal" :class="{'modal--hide-header': hideHeader || fullscreen, 'modal--fullscreen': fullscreen}">
<div class="modal__header"> <div class="modal__header">
<slot name="header"></slot> <slot name="header"></slot>
</div> </div>
@ -128,6 +128,7 @@
padding: 10px $modal-lateral-padding; padding: 10px $modal-lateral-padding;
overflow: auto; overflow: auto;
box-sizing: border-box; box-sizing: border-box;
min-height: 30vh;
} }
&__close-button { &__close-button {

View File

@ -6,6 +6,7 @@
<a class="infogram-block__link" :href="href" <a class="infogram-block__link" :href="href"
target="_blank">{{title}}</a> target="_blank">{{title}}</a>
<a class="infogram-block__link" @click="openFullscreen">Fullscreen</a>
</div> </div>
</template> </template>
@ -27,6 +28,15 @@
}); });
}, },
methods: {
openFullscreen() {
this.$store.dispatch('showFullscreenInfographic', {
id: this.value.id,
type: 'infogram-block'
});
}
},
computed: { computed: {
src() { src() {
return `https://e.infogram.com/${this.id}?src=embed`; return `https://e.infogram.com/${this.id}?src=embed`;
@ -66,6 +76,7 @@
&__link { &__link {
/*color:#989898;*/ /*color:#989898;*/
text-decoration: none; text-decoration: none;
cursor: pointer;
} }
&__iframe { &__iframe {

View File

@ -19,7 +19,11 @@ export default new Vuex.Store({
objectiveGroupType: '', objectiveGroupType: '',
currentObjectiveGroup: '', currentObjectiveGroup: '',
parentProject: null, parentProject: null,
imageUrl: '' imageUrl: '',
infographic: {
id: 0,
type: ''
}
}, },
getters: {}, getters: {},
@ -43,6 +47,10 @@ export default new Vuex.Store({
commit('setCurrentObjectiveGroup', ''); commit('setCurrentObjectiveGroup', '');
commit('setParentProject', null); commit('setParentProject', null);
commit('setImageUrl', ''); commit('setImageUrl', '');
commit('setInfographic', {
id: 0,
type: ''
});
}, },
resetContentBlockPosition({commit}) { resetContentBlockPosition({commit}) {
commit('setContentBlockPosition', {}); commit('setContentBlockPosition', {});
@ -90,6 +98,10 @@ export default new Vuex.Store({
commit('setImageUrl', payload); commit('setImageUrl', payload);
dispatch('showModal', 'fullscreen-image'); dispatch('showModal', 'fullscreen-image');
}, },
showFullscreenInfographic({commit, dispatch}, payload) {
commit('setInfographic', payload);
dispatch('showModal', 'fullscreen-infographic');
},
}, },
mutations: { mutations: {
@ -134,6 +146,9 @@ export default new Vuex.Store({
}, },
setImageUrl(state, payload) { setImageUrl(state, payload) {
state.imageUrl = payload; state.imageUrl = payload;
},
setInfographic(state, payload) {
state.infographic = payload;
} }
} }
}) })