<template>
  <svg aria-hidden="true">
    <use :href="symbolId" :fill="fill" />
  </svg>
</template>

<script lang="ts">
import { defineComponent, computed } from 'vue';

export default defineComponent({
  name: 'SvgIcon',

  props: {
    prefix: {
      type: String,
      default: 'icon',
    },
    fill: {
      type: String,
      default: 'currentColor',
    },
  },

  setup(props) {
    const symbolId = computed(() => `#${props.prefix}-${props.name}`);
    return { symbolId };
  },
});
</script>
