Skip to content

Commit

Permalink
fix: svg stroke attribute to camel-case at html to jsx (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
HoshinoSuzumi committed Apr 15, 2024
1 parent 79bbc59 commit 407636c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/htmlToJsx.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
function transformToReactJSX(jsx: string) {
const reactJSX = jsx.replace(/(class|(\w+:\w+))=/g, (i) => {
const reactJSX = jsx.replace(/(class|(stroke-\w+)|(\w+:\w+))=/g, (i) => {
if (i === 'class=')
return 'className='
return i.split(':')
return i.split(/[\:\-]/)
.map((i, idx) => idx === 0
? i.toLowerCase()
: i[0].toUpperCase() + i.slice(1).toLowerCase())
Expand Down

0 comments on commit 407636c

Please sign in to comment.