Skip to content

Commit

Permalink
fix(clerk-js): Fix custom icons props
Browse files Browse the repository at this point in the history
  • Loading branch information
anagstef committed Oct 24, 2023
1 parent 82ed0bc commit 21fbeda
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 7 additions & 2 deletions packages/clerk-js/src/ui/utils/ExternalElementMounter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type ExternalElementMounterProps = {
unmount: (el?: HTMLDivElement) => void;
};

export const ExternalElementMounter = ({ mount, unmount }: ExternalElementMounterProps) => {
export const ExternalElementMounter = ({ mount, unmount, ...rest }: ExternalElementMounterProps) => {
const nodeRef = useRef(null);

useEffect(() => {
Expand All @@ -19,5 +19,10 @@ export const ExternalElementMounter = ({ mount, unmount }: ExternalElementMounte
};
}, [nodeRef.current]);

return <div ref={nodeRef}></div>;
return (
<div
ref={nodeRef}
{...rest}
></div>
);
};
6 changes: 4 additions & 2 deletions packages/clerk-js/src/ui/utils/createCustomPages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,11 @@ const getRoutesAndContents = ({ customPages, defaultRoutes }: GetRoutesAndConten
return {
name: cp.label,
id: `custom-page-${index}`,
icon: () => (
icon: props => (
<ExternalElementMounter
mount={cp.mountIcon}
unmount={cp.unmountIcon}
{...props}
/>
),
path: sanitizeCustomLinkURL(cp.url),
Expand All @@ -137,10 +138,11 @@ const getRoutesAndContents = ({ customPages, defaultRoutes }: GetRoutesAndConten
return {
name: cp.label,
id: `custom-page-${index}`,
icon: () => (
icon: props => (
<ExternalElementMounter
mount={cp.mountIcon}
unmount={cp.unmountIcon}
{...props}
/>
),
path: pageURL,
Expand Down

0 comments on commit 21fbeda

Please sign in to comment.