<template>
  <svg aria-hidden="true" class="svg-icon" :style="`width: ${size}px;height: ${size}px;transform: rotate(${rotate}deg);`">
    <use :xlink:href="symbolId" :fill="color" />
  </svg>
</template>


<script lang="ts">
  import {
    defineComponent,
    computed,
  } from "vue";
  export default defineComponent({
    name: "SvgIcon",
    components: {},
    props: {
      prefix: {
        type: String,
        default: 'icon'
      },
      name: {
        type: String,
        required: true
      },
      color: {
        type: String,
        default: ''
      },
      size: {
        type: [Number, String],
        default: '18'
      },
      rotate: {
        type: [Number, String],
        default: 0
      }
    },
    setup(props, { emit }) {
      const symbolId = computed(() => `#${props.prefix}-${props.name}`)
      return {
        symbolId
      }
    }
  })
</script>

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