pinafore/src/routes/_components/SvgIconLegacy.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

36 lines
797 B
HTML

<!-- old browsers can't handle <use> very well -->
<svg
class={className}
{style}
aria-hidden={!ariaLabel}
aria-label={ariaLabel}
{viewBox}
ref:svg>
{@html html}
</svg>
<script>
import { animate } from '../_utils/animate'
import { store } from '../_store/store'
export default {
data: () => ({
className: '',
style: '',
ariaLabel: ''
}),
store: () => store,
computed: {
svgData: ({ href }) => process.env.ALL_SVGS[href],
html: ({ svgData }) => svgData.html,
viewBox: ({ svgData }) => svgData.viewBox
},
methods: {
animate (animation) {
const { reduceMotion } = this.store.get()
if (animation && !reduceMotion) {
animate(this.refs.svg, animation)
}
}
}
}
</script>