<script setup>
    import CloseIcon from '../assets/icons/close.svg'
</script>

<template>
    <div id="followPannel" class="windowStyle" ref="followPannel" @mousedown="$emit('focus')" @touchstart="$emit('focus')">
      <Moveable
          className="moveable"
          :target="target"
          :draggable="true"
          @drag="onDrag"
      />
      <div class="windowTitle">
        <p>
          Nous Suivre Hors des Réseaux !
        </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')">
          <CloseIcon name="close" class="icon"/>
        </button>
      </div>
      <div class="windowContent" id="followContent">

      </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){}
  */

  #followPannel{
    position: fixed;
    width: 333px;
    height: 444px;
    top: 400px;
    left: 50px;
  }

  /*================ PC LARGE*/
  @media(min-width:1300px){
    #followPannel{
      left:444px;
    }
  }
</style>

<script>
  import Moveable from 'vue3-moveable';

  export default {
    name : 'FollowPannel',
    components:{
      Moveable
    },
    data(){
      return{
        target: null
      }
    },
    emits: ['close','focus'],
    methods:{
      onDrag({ target, transform }) {
        target.style.transform = transform;
      }
    },
    mounted(){
      this.target = this.$refs.followPannel;
      console.log("Follow off-socials pannel is loaded!");
    }
  };
</script>
