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

<template>
    <div id="contactPannel" class="windowStyle" ref="contactPannel" @mousedown="$emit('focus')" @touchstart="$emit('focus')">
      <Moveable
          className="moveable"
          :target="target"
          :draggable="true"
          @drag="onDrag"
      />
      <div class="windowTitle">
        <p>
          Contacter l'orga :
        </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="contactContent">
        <div id="contactText">
          <p>Si tu veux nous contacter directement, tu peux:<br>&emsp;- nous envoyer un mail<br>&emsp;- ou un DM sur insta</p>
        </div>
        <a href="mailto:drags-nerds@epickiwi.fr" class="textBtnStyle" @touchstart.stop @mousedown.stop>
          E-MAIL
        </a>
        <a href="https://www.instagram.com/drags_nerds/?utm_source=ig_web_button_share_sheet" class="textBtnStyle" @touchstart.stop @mousedown.stop>
          INSTA
        </a>
      </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){}
  */

  #contactPannel{
    position: fixed;
    width: 333px;
    height: 350px;
    top: 154px;
    left: 66px;
  }

  #contactContent{
    width:100%;
    height:100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
  }

  #contactText{
    width:90%;
    height:16.1%;
    font-family: 'velvelyne';
    font-size: 16.1px;
    color: var(--main-color);
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: space-around;
    margin-top: 16.1px;
  }

  #contactContent .textBtnStyle{
    width: 90%;
    height: 77px;
    margin-top: 16.1px;
  }

  /*================ PC LARGE*/
  @media(min-width:1300px){
    #contactPannel{
      height: 333px;
      width: 350px;
      left: 366px;
    }
  }
</style>

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

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