<template>
  <div class="directories_containter">
    <div
      class="directory_container"
      v-for="(directory, index) in directories"
      :key="index"
      @click="view_link(directory)"
    >
      <p>{{ directory.title_text }}</p>
      <img class="directory_cover_image" :src="directory.cover_picture" />
      <p>{{ directory.summary_text }}</p>
    </div>
  </div>
</template>
<script>
import { ContentApi } from '@/utils/index'
export default {
  name: 'About',
  components: {},
  computed: {},
  mounted() {
    this.retrieve_directories()
  },
  methods: {
    retrieve_directories() {
      ContentApi.retrieve_about_directories()
        .then((response) => {
          this.directories = response.data
        })
        .catch((error) => {
          this.mnx_backendErrorHandler(error)
        })
    },
    view_link(directory) {
      this.mnx_navToLinkContentViewer(btoa(directory.content_link))
    }
  },
  data() {
    return {
      directories: null
    }
  }
}
</script>

<style scoped lang="scss">
.directories_containter {
  @extend .container;
}

.directory_container {
  @extend .container;
  cursor: pointer;
}
.directory_cover_image {
  height: 20vh;
}
</style>
