Skip to content

Commit

Permalink
feat: react component add props "className" & "style"
Browse files Browse the repository at this point in the history
  • Loading branch information
ziloen authored and Jevon617 committed Jan 5, 2024
1 parent da22acb commit da28507
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/core/snippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,24 @@ declare module 'vue' {
export const reactTemplate = `
import React from 'react';
export default function $component_name({name}) {
export default function $component_name({name,style,className}) {
return React.createElement("svg", {
xmlns: "http://www.w3.org/2000/svg",
xmlnsXlink: "http://www.w3.org/1999/xlink",
style: $component_style
style: {...$component_style, ...style},
className: className,
}, React.createElement("use", {
xlinkHref: "#" + name
}));
}
`
export const reactDts = `
declare module '${MODULE_NAME}' {
const $component_name: ({name}: {name: "$svg_symbolIds"})=> JSX.Element;
const $component_name: (props: {
name: "$svg_symbolIds",
className?:string
style?: React.CSSProperties
})=> JSX.Element;
export const svgNames: ["$svg_names"];
export type SvgName = "$svg_symbolIds";
export default $component_name;
Expand Down

0 comments on commit da28507

Please sign in to comment.