import { defineComponent } from 'vue'

export default defineComponent({
  name: 'SvgIcon',
  props: {
    prefix: {
      type: String,
      default: 'icon',
    },
    name: {
      type: String,
      required: true,
    },
    color: {
      type: String,
      default: '#333',
    },
  },
  render () {
    const {name, prefix, color,} = this
    const symbolId = `#${prefix}-${name}`

    return (
      <svg {...this.$attrs} aria-hidden="true" style={{ color: color }}>
        <use href={symbolId} fill={color} />
      </svg>
    )
  }
})
