2019-03-02 19:02:06 -08:00
|
|
|
<svg
|
|
|
|
class={className}
|
|
|
|
{style}
|
|
|
|
aria-hidden={!ariaLabel}
|
|
|
|
aria-label={ariaLabel}
|
|
|
|
ref:svg>
|
|
|
|
<use xlink:href="{inline ? '' : '/icons.svg'}{href}" />
|
|
|
|
</svg>
|
|
|
|
<script>
|
|
|
|
import { animate } from '../_utils/animate'
|
|
|
|
import { store } from '../_store/store'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data: () => ({
|
|
|
|
className: '',
|
|
|
|
style: '',
|
|
|
|
ariaLabel: ''
|
|
|
|
}),
|
|
|
|
store: () => store,
|
|
|
|
computed: {
|
2019-09-20 23:17:52 -07:00
|
|
|
inline: ({ href }) => process.env.INLINE_SVGS.includes(href)
|
2019-03-02 19:02:06 -08:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
animate (animation) {
|
2019-08-03 13:49:37 -07:00
|
|
|
const { reduceMotion } = this.store.get()
|
2019-09-20 23:17:52 -07:00
|
|
|
if (animation && !reduceMotion) {
|
|
|
|
animate(this.refs.svg, animation)
|
2019-03-02 19:02:06 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|