Skip to content

Commit

Permalink
feat: add aria role and label
Browse files Browse the repository at this point in the history
  • Loading branch information
therufa committed Aug 30, 2019
1 parent 13f8008 commit 9412120
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async function build() {
const [raw, name] = key.match(/^mdi(\w+)/i)
const fileName = path.resolve(Paths.Dist, `${name}.vue`)

const component = template(kebabCase(name), svgPath)
const component = template(kebabCase(name), svgPath, name)

const fh = await fsp.open(fileName, 'w')
await fh.writeFile(component)
Expand Down
13 changes: 11 additions & 2 deletions template.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
'use static'

module.exports = (name, path) => `<template functional>
<span class="mdi mdi-${name}">
module.exports = (name, path, ariaLabel) => `<template functional>
<span class="mdi mdi-${name}" :role="props.role" :aria-label="props.ariaLabel">
<svg
fill="currentColor"
:width="props.width"
:height="props.height"
:viewBox="props.viewBox"
Expand Down Expand Up @@ -33,6 +34,14 @@ export default {
xmlns: {
type: String,
default: 'xmlns="http://www.w3.org/2000/svg"'
},
ariaLabel: {
type: String,
default: '${ariaLabel} icon'
},
role: {
type: String,
default: 'img'
}
}
}
Expand Down

0 comments on commit 9412120

Please sign in to comment.