pinafore/src/routes/_components/SvgIcon.html
Nolan Lawson 6358af5d04
feat: add legacy build (#1502)
* feat: add legacy build

* service worker should also be in ES5

* fixup
2019-09-20 23:17:52 -07:00

32 lines
696 B
HTML

<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) {
const { reduceMotion } = this.store.get()
if (animation && !reduceMotion) {
animate(this.refs.svg, animation)
}
}
}
}
</script>