<script setup name="svgIcon">
import { computed, ref } from 'vue'

const props = defineProps({
  prefix: { type: String, default: 'icon' },
  name: { type: String, required: true },
  svgClass: { type: String, default: '' },
  color: { type: String, default: '' }
})
const symbolId = ref(computed(() => `#${props.prefix}-${props.name}`))
</script>

<template>
  <svg aria-hidden="true" :class="['svg-icon', svgClass]">
    <use :xlink:href="symbolId" :fill="color" />
  </svg>
</template>

<style scoped>
.svg-icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.1em;
  overflow: hidden;
  fill: currentColor;
}
</style>
