Mislav Lukach 764077ef3d
Feat/create UI dir (#9462)
Co-authored-by: amanape <83104063+amanape@users.noreply.github.com>
2025-07-03 13:26:19 +00:00

16 lines
380 B
TypeScript

import { cloneElement, isValidElement, type ReactElement } from "react";
import type { ComponentVariant, HTMLProps } from "../../shared/types";
export const cloneIcon = (
icon?: ReactElement<HTMLProps<"svg">>,
props?: HTMLProps<"svg">
) => {
if (!icon) {
return null;
}
if (!isValidElement(icon)) {
return null;
}
return cloneElement(icon, props ?? {});
};