feat(nx-dev): allow link-card components to take an image URL

This commit is contained in:
Juri 2025-02-05 14:09:41 +01:00 committed by Juri Strumpflohner
parent 781b300a51
commit 2f1b6f9f72

View File

@ -117,7 +117,7 @@ export function LinkCard({
}: { }: {
title: string; title: string;
type: string; type: string;
icon: string; // `icon` is the link to the SVG file icon: string; // Can be either a component name or a direct image URL
url: string; url: string;
appearance?: 'default' | 'small'; appearance?: 'default' | 'small';
}): JSX.Element { }): JSX.Element {
@ -138,13 +138,20 @@ export function LinkCard({
} }
)} )}
> >
{icon && {icon.startsWith('/') ? (
(frameworkIcons[icon as Framework]?.image || <img
callIfFunction(nxDevIcons[icon as keyof typeof nxDevIcons]) || src={icon}
callIfFunction( alt={title}
(heroIcons[icon as keyof typeof heroIcons] as any)?.render, className="h-full w-full object-contain"
{ className: 'w-full h-full' } />
))} ) : (
frameworkIcons[icon as Framework]?.image ||
callIfFunction(nxDevIcons[icon as keyof typeof nxDevIcons]) ||
callIfFunction(
(heroIcons[icon as keyof typeof heroIcons] as any)?.render,
{ className: 'w-full h-full' }
)
)}
</div> </div>
)} )}
<div <div