<template>
  <svg :class="svgClass" aria-hidden="true">
    <use :xlink:href="iconName"></use>
  </svg>
</template>

<script>
  import { computed } from "vue";
  export default {
    props: {
      type: {
        type: String,
        required: true,
      },
      className: {
        type: String,
      },
    },
    setup(props) {
      const iconName = computed(() => `#icon-${props.type}`);
      const svgClass = computed(() => (props.className ? "svg-icon " + props.className : "svg-icon"));
      return {
        iconName,
        svgClass,
      };
    },
  };
</script>

<style scoped>
  .svg-icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    fill: transparent;
    stroke: #fff;
    overflow: hidden;
  }
</style>
