pinafore/src/routes/_components/SvgIcon.html

33 lines
696 B
HTML
Raw Normal View History

<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: {
inline: ({ href }) => process.env.INLINE_SVGS.includes(href)
},
methods: {
animate (animation) {
2019-08-03 13:49:37 -07:00
const { reduceMotion } = this.store.get()
if (animation && !reduceMotion) {
animate(this.refs.svg, animation)
}
}
}
}
</script>