Created
April 27, 2018 03:10
-
-
Save jongacnik/b68be906550410c0ffe876b094d7bc96 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var html = require('choo/html') | |
module.exports = (style, classname, svg) => { | |
style = style || '' | |
classname = classname || '' | |
var viewBox = [0,0,1,1] | |
if (require('../browser')) { | |
svg.style.display = 'block' | |
svg.style.position = 'absolute' | |
svg.style.top = 0 | |
svg.style.left = 0 | |
svg.style.width = '100%' | |
svg.style.height = '100%' | |
viewBox = svg.getAttribute('viewBox').split(' ') | |
} | |
return html` | |
<div style=${style} class="${classname}"> | |
<canvas width="${viewBox[2]}" height="${viewBox[3]}"></canvas> | |
${svg} | |
</div> | |
` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment