Added loader for icon fallback
This commit is contained in:
parent
b3ad7fa49f
commit
92734e795b
1 changed files with 5 additions and 1 deletions
|
|
@ -2,6 +2,8 @@ import dynamicIconImports from "lucide-react/dynamicIconImports";
|
|||
import { Suspense, forwardRef, lazy, memo } from "react";
|
||||
import { IconComponentProps } from "../../types/components";
|
||||
import { nodeIconsLucide } from "../../utils/styleUtils";
|
||||
import { cn } from "../../utils/utils";
|
||||
import Loading from "../ui/loading";
|
||||
|
||||
const ForwardedIconComponent = memo(
|
||||
forwardRef(
|
||||
|
|
@ -34,7 +36,9 @@ const ForwardedIconComponent = memo(
|
|||
return null; // Render nothing until the icon is loaded
|
||||
}
|
||||
const fallback = (
|
||||
<div style={{ background: "#ddd", width: 24, height: 24 }} />
|
||||
<div className={cn(className, "flex items-center justify-center")}>
|
||||
<Loading />
|
||||
</div>
|
||||
);
|
||||
return (
|
||||
<Suspense fallback={fallback}>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue