<template>
  <component :is="tagType" class="text-link" v-on="$listeners" v-bind="$attrs">
    <slot></slot>
  </component>
</template>

<script>
import EbLinkScroll from './eb-link-scroll';

export default {
  name: 'EbLink',

  inheritAttrs: false,

  components: { EbLinkScroll },

  props: {
    scroll: { type: Boolean, default: false },
    inertia: { type: Boolean, default: false },
    nuxt: { type: Boolean, default: false }
  },

  computed: {
    tagType() {
      if (this.$attrs.to && !this.$attrs.href) return 'router-link';

      if (this.scroll) return 'eb-link-scroll';

      if (this.nuxt) return 'nuxt-link';

      return this.inertia ? 'inertia-link' : 'a';
    }
  }
};
</script>

<style>
.text-link {
  cursor: pointer;
}
</style>
