mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 18:44:16 +00:00
support passing valid element
This commit is contained in:
parent
03e0ef7f0c
commit
b5303beab1
@ -42,6 +42,10 @@ export const Icons = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function createIconRender(icon, props) {
|
export function createIconRender(icon, props) {
|
||||||
|
if (React.isValidElement(icon)) {
|
||||||
|
return icon
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof Icons[icon] !== "undefined") {
|
if (typeof Icons[icon] !== "undefined") {
|
||||||
return React.createElement(Icons[icon], props)
|
return React.createElement(Icons[icon], props)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user