<template>
  <svg :class="svgClass" :aria-hidden="true">
    <use :xlink:href="iconName" :fill="color" />
  </svg>
</template>
<script>
export default {
  name: "svg-icon",
  props: {
    iconClass: {
      type: String,
      required: true,
    },
    className: {
      type: String,
      default: "",
    },
    color: {
      type: String,
      default: "#999",
    },
    hoverStyle: {
      type: String,
      default: "",
    },
  },
  computed: {
    iconName() {
      if (!this.iconClass) {
        return "#icon-default";
      }
      return `#icon-${this.iconClass}`;
    },
    svgClass() {
      if (this.className) {
        return "svg-icon " + this.className;
      } else {
        return "svg-icon";
      }
    },
  },
};
</script>
<style scoped lang="scss">
.svg-icon {
  width: 100%;
  height: 100%;
  fill: currentColor;
  overflow: hidden;
  font-size: 30px;
}
.hover {
  :hover {
    cursor: pointer;
  }
}
</style>
