3 Commits

Author SHA1 Message Date
pheralb ab16011b25 🛠️ Use `import type from SVGProps instead import * from React`
📦 Build / 🛠️ Build app (push) Has been cancelled
🧑‍🚀 Check / ⚙️ Linting (push) Has been cancelled
🧑‍🚀 Check / 📦 SVGs Size (push) Has been cancelled
🚀 Deploy / ☁️ API (push) Has been cancelled
2025-09-30 00:29:11 +01:00
Pablo Hdez 204b13c445 Merge pull request #778 from ongkristopher/patch-1
Fix clip-path issue on react
2025-09-29 19:05:17 +01:00
Kristopher Pamplona Ong f28f171d3b Fix clip-path issue on react 2025-09-27 04:34:20 +08:00
+3 -2
View File
@@ -15,6 +15,7 @@ export const parseReactSvgContent = async ({
.replace("<svg", "<svg {...props}")
.replace(/class="/g, 'className="')
.replace(/clip-rule="/g, 'clipRule="')
.replace(/clip-path="/g, 'clipPath="')
.replace(/fill-rule="/g, 'fillRule="')
.replace(/stroke-width="/g, 'strokeWidth="')
.replace(/stroke-linecap="/g, 'strokeLinecap="')
@@ -28,8 +29,8 @@ export const parseReactSvgContent = async ({
let structuredCode = "";
if (typescript) {
structuredCode =
`import * as React from 'react';\n\n` +
`const ${componentName} = (props: React.SVGProps<SVGSVGElement>) => (\n ${reactifiedSvg}\n);\n\n` +
`import type { SVGProps } from "react";\n\n` +
`const ${componentName} = (props: SVGProps<SVGSVGElement>) => (\n ${reactifiedSvg}\n);\n\n` +
`export { ${componentName} };`;
} else {
structuredCode = `const ${componentName} = (props) => (\n ${reactifiedSvg}\n);\n\nexport { ${componentName} };`;