@@ -6,7 +6,7 @@ import svgoConfig from "../svgo.config.mjs";
66export const createDeveloperIcon = (
77 iconName : string ,
88 iconContent : string ,
9- path : string
9+ path : string ,
1010) => {
1111 const optimizedSvg = optimize ( iconContent , {
1212 path,
@@ -32,11 +32,11 @@ export const createDeveloperIcon = (
3232 return `${ key } =${ JSON . stringify ( value ) } ` ;
3333 }
3434 } ,
35- } )
35+ } ) ,
3636 ) ;
3737
3838 return `import { createElement } from 'react';\nimport {Icon, DeveloperIconProps} from '../icon';\nexport const ${ iconName } = (props: DeveloperIconProps) => createElement(Icon, {...${ JSON . stringify (
39- sanitizedSvgObject . attributes
39+ sanitizedSvgObject . attributes ,
4040 ) } , ...props, children: [${ children } ]
4141 })` ;
4242} ;
@@ -49,15 +49,20 @@ const sanitizeStyles = (svgObject: INode) => {
4949 . trim ( ) ;
5050
5151 if ( styleString ) {
52- const styleObject = styleString . split ( ";" ) . reduce ( ( acc , style ) => {
53- const [ key , value ] = style . split ( ":" ) . map ( ( s ) => s . trim ( ) ) ;
54- if ( key && value ) {
55- // Convert kebab-case to camelCase
56- const camelKey = key . replace ( / - ( [ a - z ] ) / g, ( g ) => g [ 1 ] . toUpperCase ( ) ) ;
57- acc [ camelKey ] = value ;
58- }
59- return acc ;
60- } , { } as Record < string , string > ) ;
52+ const styleObject = styleString . split ( ";" ) . reduce (
53+ ( acc , style ) => {
54+ const [ key , value ] = style . split ( ":" ) . map ( ( s ) => s . trim ( ) ) ;
55+ if ( key && value ) {
56+ // Convert kebab-case to camelCase
57+ const camelKey = key . replace ( / - ( [ a - z ] ) / g, ( g ) =>
58+ g [ 1 ] . toUpperCase ( ) ,
59+ ) ;
60+ acc [ camelKey ] = value ;
61+ }
62+ return acc ;
63+ } ,
64+ { } as Record < string , string > ,
65+ ) ;
6166
6267 //@ts -expect-error string style is converted into object style
6368 modifiedSvgObject . attributes . style = styleObject ;
0 commit comments