Feature/icon name class (#395)
* #317 Add icon-names to class list for Vue. * #317 Tidy up class name.
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user