Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed May 30, 2024
1 parent b555986 commit f4a5ca8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/utils/htmlToJsx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ function transformToReactJSX(jsx: string) {
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
4 changes: 2 additions & 2 deletions src/utils/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ export async function getSvgSymbol(icon: string, size = '1em', color = 'currentC
// Grab the inner HTML and move into a symbol element
symbolElem.innerHTML = node.querySelector('svg')!.innerHTML
symbolElem.setAttribute('viewBox', node.querySelector('svg')!.getAttribute('viewBox')!)
symbolElem.id = icon.replace(/\:/, '-') // Simple slugify for quick symbol lookup
symbolElem.id = icon.replace(/:/, '-') // Simple slugify for quick symbol lookup

return symbolElem?.outerHTML
}

export function toComponentName(icon: string) {
return icon.split(/:|-|_/).filter(Boolean).map(s => s[0].toUpperCase() + s.slice(1).toLowerCase()).join('')
return icon.split(/[:\-_]/).filter(Boolean).map(s => s[0].toUpperCase() + s.slice(1).toLowerCase()).join('')
}

export function ClearSvg(svgCode: string, reactJSX?: boolean) {
Expand Down

0 comments on commit f4a5ca8

Please sign in to comment.