<template>
  <div class="content-box">

    <div class="flex between-xs middle-xs"  @click.prevent=" isMobile ? showContent = !showContent : ''">
      <h4 class="footer-title text-small text-bold vertical-margin-x-small">{{ language.text_service }}</h4>
      <i class="fas hidden-md-up" :class="showContent && isMobile ? 'fa-angle-up' : 'fa-angle-down'"></i>
    </div>

    <transition name="services-transition">
      <div v-if="showContent"> 

        <div v-for="(data, key) in services" :key="key">
          <a :href="data.link" class="text-small visible-block vertical-padding-x-small" :title="data.text">{{ data.text }}</a>
        </div>

      </div>
    </transition>

  </div>
</template>

<script>
import store from "@components/TheFooter/storeFooter.js";

export default {
  name: 'CustomServices',
  data() {
    return {
      services: store.state.customServices,
      language: store.state.languages,
      showContent: true, 
      isMobile: false,
    };
  },
  methods: {
    resize() {
      this.isMobile =  window.innerWidth < 992 ?? false;
      this.showContent = !this.isMobile ?? true;

      window.addEventListener('resize', () => {
        this.isMobile =  window.innerWidth < 992 ?? false;
        this.showContent = !this.isMobile ?? true;
      });
    },
  },
  created() {
    this.resize();
  },
}
</script>

<style scoped>
.services-transition-enter-active {
transition: all .3s ease;
}
.services-transition-leave-active {
  transition: all .3s cubic-bezier(1.0, 0.5, 0.8, 1.0);
}
.services-transition-enter, .services-transition-leave-to {
  transform: translateY(-20px);
  opacity: 0;
}
</style>