Feature/icon name class (#395)

* #317 Add icon-names to class list for Vue.

* #317 Tidy up class name.
This commit is contained in:
Snow
2021-09-14 05:13:52 +10:00
committed by GitHub
parent c537469638
commit 2200ab47d3

View File

@@ -1,5 +1,15 @@
import defaultAttributes from './defaultAttributes';
/**
* Converts string to KebabCase
* Copied from scripts/helper. If anyone knows how to properly import it here
* then please fix it.
*
* @param {string} string
* @returns {string} A kebabized string
*/
export const toKebabCase = string => string.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
export default (iconName, iconNode) => ({
name: iconName,
functional: true,
@@ -18,7 +28,7 @@ export default (iconName, iconNode) => ({
},
defaultClass: {
type: String,
default: 'lucide-icon',
default: `lucide-icon lucide lucide-${toKebabCase(iconName).replace('-icon', '')}`,
},
},
render(