added fallback icon in IconComponent
This commit is contained in:
parent
2f1b675122
commit
18820facbb
1 changed files with 4 additions and 3 deletions
|
|
@ -2,12 +2,12 @@ import { IconComponentProps, IconProps } from "../../types/components";
|
|||
import { nodeIconsLucide, svgIcons } from "../../utils";
|
||||
|
||||
export function IconFromLucide({ name }: IconProps): JSX.Element {
|
||||
const TargetIcon = nodeIconsLucide[name];
|
||||
const TargetIcon = nodeIconsLucide[name] ?? nodeIconsLucide["unknown"];
|
||||
return <TargetIcon />;
|
||||
}
|
||||
|
||||
export function IconFromSvg({ name }: IconProps): JSX.Element {
|
||||
const TargetSvg = svgIcons[name];
|
||||
const TargetSvg = svgIcons[name] ?? nodeIconsLucide["unknown"];
|
||||
return <TargetSvg />;
|
||||
}
|
||||
|
||||
|
|
@ -21,6 +21,7 @@ export default function IconComponent({
|
|||
case "LUCIDE":
|
||||
return <IconFromLucide name={name} />;
|
||||
default:
|
||||
return;
|
||||
console.error("IconComponent: invalid method");
|
||||
return <IconFromLucide name={"unknown"} />;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue