<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_account }}</h4>
      <i class="fas hidden-md-up" :class="showContent && isMobile ? 'fa-angle-up' : 'fa-angle-down'"></i>
    </div>

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

        <div v-for="(data, key) in accountInfo" :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: 'CustomAccount',
  data() {
    return {
      accountInfo: store.state.customAccount,
      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>
.account-transition-enter-active {
transition: all .3s ease;
}
.account-transition-leave-active {
  transition: all .3s cubic-bezier(1.0, 0.5, 0.8, 1.0);
}
.account-transition-enter, .account-transition-leave-to {
  transform: translateY(-20px);
  opacity: 0;
}
</style>