<template>
  <v-card tile outlined :class="{ 'card--reduced': isCardReduced }">
    <v-card-title class="card__title primary" @click="toggleCardSize">
      <v-icon left class="white--text pr-5 pl-2" size="40">mdi-camera-control</v-icon>
      Contrôles
    </v-card-title>
    <v-container class="text-center">
      <v-row justify="center">
        <v-col cols="12" sm="6" md="5" class="mt-4">
          <mqtt-button width="220" height="110" class="btn xs12 sm6 md3" topic="/display/control" message="previous">
            <v-icon left size="80">mdi-skip-previous</v-icon>
          </mqtt-button>
        </v-col>
        <v-col cols="12" sm="6" md="5" class="mt-4">
          <mqtt-button width="240" height="110" class="btn card xs12 sm6 md3" topic="/display/control" message="next">
            <v-icon left size="80">mdi-skip-next</v-icon>
          </mqtt-button>
        </v-col>
        <v-col cols="12" sm="6" md="5" class="mb-4">
          <mqtt-button width="240" height="110" class="btn card xs12 sm6 md3" topic="/display/control" message="pause">
            <v-icon left size="80">mdi-pause</v-icon>
          </mqtt-button>
        </v-col>
        <v-col cols="12" sm="6" md="5" class="mb-4">
          <mqtt-button width="240" height="110" class="btn card xs12 sm6 md3 " topic="/display/control" message="play">
            <v-icon left size="80">mdi-play</v-icon>
          </mqtt-button>
        </v-col>
      </v-row>
    </v-container>
  </v-card>
</template>

<script setup>
  import MqttButton from './MqttButton.vue';
  import { ref } from 'vue';

  // Variable pour contrôler l'état de la carte
  const isCardReduced = ref(false);

  // Méthode pour basculer l'état de la carte
  function toggleCardSize() {
    isCardReduced.value = !isCardReduced.value;
  }
</script>

<style>
.card--reduced {
    height: 56px; /* Réglez la hauteur réduite selon vos besoins */
    width: 170px;
    overflow: hidden;
    transition: height 0.3s ease-in-out;
  }
</style>