diff --git a/src/custom/CustomCatalog/custom-card.tsx b/src/custom/CustomCatalog/custom-card.tsx index c90d78f8..1f835192 100644 --- a/src/custom/CustomCatalog/custom-card.tsx +++ b/src/custom/CustomCatalog/custom-card.tsx @@ -65,13 +65,8 @@ type CatalogCardProps = { cardHeight: string; cardWidth: string; cardStyles: React.CSSProperties; - type: string; version?: string; avatarUrl: string; - compatibility: string[]; - userName: string; - technologies: string[]; - updatedAt: string; shouldFlip?: boolean; cardTechnologies?: boolean; isDetailed?: boolean; @@ -82,7 +77,9 @@ type CatalogCardProps = { children?: React.ReactNode; // catalogImage TechnologyComponent?: React.ReactNode; basePath?: string; // path of meshmodel img stored + subBasePath?: string; // path of meshmodel img stored getHostUrl?: () => string; + onCardClick?: () => void; }; export const ClassToIconMap = { @@ -109,7 +106,6 @@ const CustomCatalogCard: React.FC = ({ cardHeight, cardWidth, cardStyles, - cardLink, shouldFlip, isDetailed, cardTechnologies, @@ -118,7 +114,9 @@ const CustomCatalogCard: React.FC = ({ UserName, children, basePath, - getHostUrl + subBasePath, + getHostUrl, + onCardClick }) => { const outerStyles = { height: cardHeight, @@ -153,7 +151,7 @@ const CustomCatalogCard: React.FC = ({ const handleImage = async () => { const validSvgPaths = []; for (const technology of technologies) { - const svgIconPath = `${basePath}/${technology.toLowerCase()}/icons/color/${technology.toLowerCase()}-color.svg`; + const svgIconPath = `${basePath}/${technology.toLowerCase()}/${subBasePath}/${technology.toLowerCase()}-color.svg`; const isSvgPathValid = await checkImageUrlValidity(svgIconPath as string); if (isSvgPathValid) { validSvgPaths.push(technology); @@ -180,178 +178,181 @@ const CustomCatalogCard: React.FC = ({ } return ( - - - - - {isDetailed && ( - <> - - {patternType} + + + + {isDetailed && ( + <> + + {patternType} - - {pattern.name} - - - )} - -
- {children} -
-
- {isDetailed && ( - - - - {pattern.download_count} - - - - {pattern.clone_count} - - - - {pattern.view_count} - - - - {pattern.deployment_count} - - - - {pattern.share_count} - - - )} -
- {shouldFlip && ( - - - - {UserName} - + {pattern.name} + + + )} + +
+ {children} +
+
+ {isDetailed && ( + + + + {pattern.download_count} + + + + {pattern.clone_count} + + + + {pattern.view_count} + + + + {pattern.deployment_count} + + + + {pattern.share_count} + + + )} +
+ {shouldFlip && ( + + + + {UserName} + - - {cardTechnologies && ( - - Technologies - - {technologies.length < 1 || availableTechnologies.length < 1 ? ( - No technologies - ) : ( - <> - {availableTechnologies.slice(0, techlimit).map((technology, index) => { - const svgPath = - (getHostUrl ? getHostUrl() : '') + - `${basePath}/${technology.toLowerCase()}/icons/color/${technology.toLowerCase()}-color.svg`; - return ( - - - {technology.toLowerCase()} - - - ); - })} - {availableTechnologies.length > techlimit && ( - - +{availableTechnologies.length - techlimit} + + {cardTechnologies && ( + + Technologies + + {technologies.length < 1 || availableTechnologies.length < 1 ? ( + No technologies + ) : ( + <> + {availableTechnologies.slice(0, techlimit).map((technology, index) => { + const svgPath = + (getHostUrl ? getHostUrl() : '') + + `${basePath}/${technology.toLowerCase()}/${subBasePath}/${technology.toLowerCase()}-color.svg`; + return ( + + + {technology.toLowerCase()} + - )} - - )} - - - )} - + ); + })} + {availableTechnologies.length > techlimit && ( + + +{availableTechnologies.length - techlimit} + + )} + + )} + + + )} + - {isDetailed && ( - - - + + +
-
- - Updated At -
- - {' '} - {new Date(pattern.updated_at.toString().slice(0, 10)).toLocaleDateString( - 'en-US', - { - day: 'numeric', - month: 'long', - year: 'numeric' - } - )} - - + + Updated At +
+ + {' '} + {new Date(pattern.updated_at.toString().slice(0, 10)).toLocaleDateString( + 'en-US', + { + day: 'numeric', + month: 'long', + year: 'numeric' + } + )} +
-
- )} - {cardVersion && ( - - v{cardVersion} - - )} -
- )} -
-
-
+ + + )} + {cardVersion && ( + + v{cardVersion} + + )} + + )} + + ); };