mirror of
https://github.com/antfu-collective/icones.git
synced 2026-01-09 07:40:49 +08:00
fix: qwik output (#134)
This commit is contained in:
parent
b5fc47abb6
commit
87e9970220
@ -79,6 +79,18 @@ export function ${name}(props: SVGProps<SVGSVGElement>) {
|
||||
return prettierCode(code, 'babel-ts')
|
||||
}
|
||||
|
||||
export function SvgToQwik(svg: string, name: string, snippet: boolean) {
|
||||
let code = `
|
||||
export function ${name}(props: QwikIntrinsicElements['svg'], key: string) {
|
||||
return (
|
||||
${ClearSvg(svg, false).replace(/<svg (.*?)>/, '<svg $1 {...props} key={key}>')}
|
||||
)
|
||||
}`
|
||||
|
||||
code = snippet ? code : `import type { QwikIntrinsicElements } from '@builder.io/qwik'\n${code}\nexport default ${name}`
|
||||
return prettierCode(code, 'babel-ts')
|
||||
}
|
||||
|
||||
export function SvgToVue(svg: string, name: string, isTs?: boolean) {
|
||||
const contet = `
|
||||
<template>
|
||||
@ -128,7 +140,7 @@ export async function getIconSnippet(icon: string, type: string, snippet = true,
|
||||
case 'tsx':
|
||||
return SvgToTSX(await getSvg(icon, undefined, color), toComponentName(icon), snippet)
|
||||
case 'qwik':
|
||||
return SvgToTSX(await getSvg(icon, undefined, color), toComponentName(icon), snippet, false)
|
||||
return SvgToQwik(await getSvg(icon, undefined, color), toComponentName(icon), snippet)
|
||||
case 'vue':
|
||||
return SvgToVue(await getSvg(icon, undefined, color), toComponentName(icon))
|
||||
case 'vue-ts':
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user