Skip to content

Instantly share code, notes, and snippets.

@cannap
Created June 3, 2017 16:57
Show Gist options
  • Save cannap/e3be08091ac1b489f32fba571e7367ab to your computer and use it in GitHub Desktop.
Save cannap/e3be08091ac1b489f32fba571e7367ab to your computer and use it in GitHub Desktop.
function template (data) {
return `
const ${data.componentName} = {
functional: true,
name: '${data.componentName}',
props: {
height: {
type: [String, Number],
default: 24
},
width: {
type: [String, Number],
default: 24
},
viewBox: {
type: String
},
className: {
type: [Object, Array, String]
},
styles: {
type: [Object, Array, String]
}
},
render (h, ctx) {
const svg = h('svg', {
class: ctx.props.className,
style: ctx.props.styles,
preserveAspectRatio:'xMidYMid meet',
attrs: {
height: ctx.props.height,
width: ctx.props.width,
viewBox: ctx.props.viewBox || '${data.viewBox}',
fill: 'currentColor',
},
domProps: {
innerHTML:'<g>${data.content}</g>'
}
})
return svg
}
}
export default ${data.componentName}
`
}
module.exports = template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment