<template>
  <NuxtImg :src="imgSrc" alt="" class="img-fluid" />
</template>

<script>
/**
 * @vue-prop {Array} list - لیست
 * @vue-prop {*} clickedItem - آیتمی که کلیک شده است
 * @vue-prop {*} contextMenu - منو که از سمت والد دریافت میگردد
 * @vue-prop {*} parentComponent - کامپوننت والد
 */

export default {
  // contextMenu: right click actions
  // list: folder or file list.
  // clickedItem: selected item in the loop.
  props: ["iconName"],
  async mounted() {
    let res = "";

    try {
      res = await import(`assets/common/img/${this.iconName}.svg`);
    } catch (err) {
      res = await import(`assets/common/img/icomoon/SVG/${this.iconName}.svg`);
    }

    this.imgSrc = res.default;
  },
  data() {
    return {
      imgSrc: "",
    };
  },
};
</script>