<template>
  <div id="Chapter1_1" class="content-wrap">
    <div class="title-box mb25 flex align-center mt40">
      <span class="title mr40">1. Hello WORLD</span>
      <span class="subtitle">my name is dd</span>
    </div>
    <div class="flex justify-between align-center">
      <div class="pre-btn" @click="goToPage('Chapter2_5')"><img src="../../../../resources/img/left.png" alt=""></div>
      <div class="content title-box">
        <p class="title mt25 title-bg">앗! 퍼즐이 망가졌어! 퍼즐을 맞춰 문장을 완성해보자!</p>
        <p class="subtitle2 "></p>

        <div class="mt50 text-ct">
          <div class="dropGroup  mt30">
            <div class="flex justify-center">
              <div class="popTxt" id="drop1">
                <img src="../../../../resources/img/img66_38s_1.png" alt="" @click="showButton(1)" >
                <button  v-if="showButton1"><img src="../../../../resources/img/img66_38s_1_color.png" alt="" ><p>i</p></button>
              </div>
              <div class="popTxt" id="drop2" >
                <img src="../../../../resources/img/img66_38s_2.png" alt="" @click="showButton(2)" >
                <button v-if="showButton2"><img src="../../../../resources/img/img66_38s_2_color.png" alt="" ><p>have</p></button>
              </div>
              <div class="popTxt" id="drop3">
                <img src="../../../../resources/img/img66_38s_3.png" alt="" @click="showButton(3)" >
                <button  v-if="showButton3"><img src="../../../../resources/img/img66_38s_3_color.png" alt="" ><p>banana</p></button>
              </div>
            </div>

          </div>
          <div class="dragGroup mt40">
            <article style="  right: 0;
    top: 36%;  " @click="handleDrag(1)" v-show="!dragHidden1">
              <button id="drag1">
                <img src="../../../../resources/img/img67_38s.png" alt="">
                <p>i</p>
              </button>
            </article>
            <article style="  left: 0;
    top: 36%;   " @click="handleDrag(2)" v-show="!dragHidden2">
              <button id="drag2"> 
                <img src="../../../../resources/img/img68_38s.png" alt="">
                <p>have</p>
              </button>
            </article>
           <article style="left: 50%;
    top: 10%;"  @click="handleDrag(3)" v-show="!dragHidden3">
              <button id="drag3">
                <img src="../../../../resources/img/img69_38s.png" alt="">
                <p>banana</p>
              </button>
           </article>

          </div>
        </div>
      </div>
      <div class="next-btn" @click="goToPage('Chapter2_7')"><img src="../../../../resources/img/right.png" alt=""></div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      showButton1: false,
      showButton2: false,
      showButton3: false,
      dragHidden1: false,
      dragHidden2: false,
      dragHidden3: false,
    }
  },
  methods: {
    goToPage(page) {
      this.$router.push({ name: page });
    },
    handleDrag(dragNumber) {
      // Drag 버튼 숨기기
      // 여기서는 상태 관리를 통해 버튼을 제어합니다.
      if (dragNumber === 1) {
        this.showButton1 = false;
      } else if (dragNumber === 2) {
        this.showButton2 = false;
      } else if (dragNumber === 3) {
        this.showButton3 = false;
      }
    },
    showButton(dropNumber) {
      // Drop 영역의 이미지 클릭 이벤트 핸들러 설정
      // 여기서는 상태 관리를 통해 버튼을 보이게 합니다.
      if (dropNumber === 1) {
        this.showButton1 = true;
        this.dragHidden1 = true;
      } else if (dropNumber === 2) {
        this.showButton2 = true;
        this.dragHidden2 = true;
      } else if (dropNumber === 3) {
        this.showButton3 = true;
        this.dragHidden3 = true;
      }
    },
  },
  watch: {

  },
  computed: {

  },
  components: {
  },
  mounted() {

  }
}
</script>
<style scoped>
.dropGroup button{ left: 0;}
.dragGroup button p{color: #fff; font-size: 35px;}
.dropGroup button p{
  font-size: 48px;
  color: #fff;}
</style>