Files
drags-and-nerds/v1-com-officielle/src/indieComponents/VideoPannel.vue
T

114 lines
2.9 KiB
Vue

<script setup>
import CloseIcon from '../assets/icons/close.svg'
import LikeIcon from '../assets/icons/like.svg'
</script>
<template>
<div id="videoPannel" class="windowStyle" ref="videoPannel" @mousedown="$emit('focus')" @touchstart="$emit('focus')">
<Moveable
className="moveable"
:target="target"
:draggable="true"
@drag="onDrag"
/>
<div class="windowTitle">
<p>
{{selectedVideo.caption}}
</p>
<!-- touchstart.capture pour passer en prio sur déplacement fenêtre/ .stop si pas de method-->
<button type="button" class="closeBtn" @mousedown.capture="$emit('close')" @touchstart.capture="$emit('close')" data-tooltip="fermer">
<CloseIcon name="close" class="icon"/>
</button>
</div>
<div class="windowContent" id="visualizerContent">
<video controls id="displayedImgStyle" :src="selectedVideo.src" :type="selectedVideo.format">
</video>
<div class="reactBar">
<p class="reactStatStyle">{{selectedVideo.like}}</p>
<button data-tooltip="j'aime bien" type="button" class="iconBtnStyle" :class="{reactedStyle: selectedVideo.isLiked}" @mousedown.capture="likeImg" @touchstart.capture="likeImg">
<LikeIcon name="test" class="icon"/>
</button>
</div>
</div>
</div>
</template>
<style scoped>
/*================= Mise en page:
=> Mobile First : par défaut, moins de 500px
=> Tablette et PC format haut : de 500 à 1000px
=> PC large : à partir de 1000px
*/
/*+++++++++++++++++ COPYBOX
================ PC HAUT/IPAD
@media(min-width:650px){}
================ PC LARGE
@media(min-width:1300px){}
*/
#videoPannel{
position: fixed;
width: 333px;
height: auto;
top: 500px;
left: 16.1px;
border-radius: 16.1px;
}
#videoContent{
align-items: flex-start;
}
#displayedImgStyle{
width:100%;
height:auto;
margin: 0;
padding: 0;
}
/*================ PC LARGE*/
@media(min-width:1300px){
#videoPannel{
top: 333px;
left: 161px;
}
}
</style>
<script>
import Moveable from 'vue3-moveable';
import { dataStorage } from '../dataExchange.js'
export default {
name : 'VideoPannel',
components:{
Moveable
},
data(){
return{
target: null
}
},
emits: ['close','focus'],
computed: {
selectedVideo(){
return dataStorage.selectedVideo
}
},
methods:{
onDrag({ target, transform }) {
target.style.transform = transform;
},
likeImg(){
this.selectedVideo.isLiked = !this.selectedVideo.isLiked;
console.log(this.selectedVideo);
}
},
mounted(){
this.target = this.$refs.videoPannel;
console.log("Video pannel is loaded!");
}
};
</script>