<template>
  <div class="directories_containter">
    <div
      class="directory_container"
      v-for="(directory, index) in directories"
      :key="index"
      @click="view_link(directory)"
    >
      <img class="directory_cover_image" :src="directory.cover_picture" />
      <p class="directory-title">{{ directory.title_text }}</p>
      <p class="directory-subtitle">{{ directory.summary_text }}</p>
      <button class="btn btn-link">{{ $t('Read More') }}</button>
    </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(window.location.host)
        .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;
  padding: 56px 40px;
}

.directory_container {
  @extend .container;
  padding: 0;
  cursor: pointer;
  text-align: left;

  .btn-link {
    margin-bottom: 24px;
    text-decoration: underline;
    padding: 0;
  }
}

.directory_cover_image {
  width: 100%;
  border-radius: 16px;
  margin-bottom: 16px;
}

.directory-title {
  font-size: 48px;
  // font-weight: bold;
  color: #18181a;
  margin-bottom: 5px;
}

.directory-subtitle {
  font-size: 14px;
  color: #666666;
}
</style>
