<template>
  <div class="folder-item-container p-m" @click="goToFolder">
    <SvgFolder v-if="folder.svg" width="56" height="56" :path="folder.svg" />

    <Title tag="h5">{{ folder.title }}</Title>
  </div>
</template>

<script>
import { Title } from 'inside-collection/atoms'

import GedNavigationMixin from '../../ged/mixins/ged-navigation-mixin'

import { formatHref } from '@inside-library/helpers/Langs'

import SvgFolder from '../../SvgFolder'

export default {
  name: 'FolderItem',
  components: { Title, SvgFolder },
  mixins: [GedNavigationMixin],
  props: {
    folder: {
      type: Object,
      required: true
    },
    parent: {
      type: String,
      required: true
    }
  },
  methods: {
    goToFolder() {
      this.$router.push(
        formatHref(
          {
            name: 'GedPageCustom',
            params: {
              folder: this.parent,
              subFolder: this.folder.slug[0]
            }
          },
          this.$_currentLang
        )
      )
    }
  }
}
</script>

<style lang="scss">
.folder-item-container {
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: center;
  height: 140px;
  text-align: center;
  box-shadow: var(--shadow-default);
  cursor: pointer;
  user-select: none;

  .svg-folder-container {
    margin: 0;
  }
}
.inside-radius {
  .folder-item-container {
    border-radius: var(--radius-m);
  }
}
</style>
