diff options
author | Vitaly Takmazov | 2023-05-31 06:10:51 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-05-31 06:11:05 +0300 |
commit | f2a7ea3af919548d41383734e8a3667086a44bcc (patch) | |
tree | e0d9db07956f10ccc4e27fc9e0d45d88950dbfbb /src/main/assets/icon.js | |
parent | 395185d093b2d6bb46d02830088e00a3a2ca20c1 (diff) |
eslint: enforce semicolons only before statement continuation chars
Diffstat (limited to 'src/main/assets/icon.js')
-rw-r--r-- | src/main/assets/icon.js | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/main/assets/icon.js b/src/main/assets/icon.js index 6ab3cd81..c94a1663 100644 --- a/src/main/assets/icon.js +++ b/src/main/assets/icon.js @@ -1,40 +1,43 @@ -import evilIcons from 'evil-icons/assets/sprite.svg'; +import evilIcons from 'evil-icons/assets/sprite.svg' function icon(name, { size = '', className = '' }) { - const classes = `icon icon--${name} icon--${size} ${className}`.trim(); + const classes = `icon icon--${name} icon--${size} ${className}`.trim() var icon = '<svg class="icon__cnt">' + `<use xlink:href='${evilIcons}#${name}-icon' />` + - '</svg>'; + '</svg>' var html = '<div class="' + classes + '">' + wrapSpinner(icon, classes) + - '</div>'; + '</div>' - return html; + return html } function wrapSpinner(html, klass) { if (klass.indexOf('spinner') > -1) { - return '<div class="icon__spinner">' + html + '</div>'; + return '<div class="icon__spinner">' + html + '</div>' } else { - return html; + return html } } +/** + * + */ export default function renderIcons() { - var render = true; - var icons = document.querySelectorAll('[data-icon]'); + var render = true + var icons = document.querySelectorAll('[data-icon]') for (var i = 0; i < icons.length; i++) { - var currentIcon = icons[i]; - var name = currentIcon.getAttribute('data-icon'); + var currentIcon = icons[i] + var name = currentIcon.getAttribute('data-icon') var options = { className: currentIcon.className, size: currentIcon.getAttribute('data-size') - }; + } - currentIcon.insertAdjacentHTML('beforebegin', icon(name, options)); - currentIcon.parentNode.removeChild(currentIcon); + currentIcon.insertAdjacentHTML('beforebegin', icon(name, options)) + currentIcon.parentNode.removeChild(currentIcon) } } |