import React, { forwardRef, useContext } from "react"; import { IconProps, IconWeight, IconContext } from "../lib"; export type RenderFunction = ( weight: IconWeight, color: string ) => React.ReactNode | null; interface IconBaseProps extends IconProps { renderPath: RenderFunction; } const IconBase = forwardRef((props, ref) => { const { alt, color, size, weight, mirrored, children, renderPath, ...restProps } = props; const { color: contextColor = "currentColor", size: contextSize, weight: contextWeight = "regular", mirrored: contextMirrored = false, ...restContext } = useContext(IconContext); return ( {!!alt && {alt}} {children} {renderPath(weight ?? contextWeight, color ?? contextColor)} ); }); IconBase.displayName = "IconBase"; export default IconBase;