diff --git a/frontend/src/components/Card.tsx b/frontend/src/components/Card.tsx index dc2e4ad241..be8dcbaf23 100644 --- a/frontend/src/components/Card.tsx +++ b/frontend/src/components/Card.tsx @@ -1,21 +1,15 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { Tooltip } from '@heroui/tooltip' import Link from 'next/link' -import { useState, useEffect } from 'react' import { CardProps } from 'types/card' -import { desktopViewMinWidth } from 'utils/constants' import { Icons } from 'utils/data' import { getSocialIcon } from 'utils/urlIconMappings' -import { cn } from 'utils/utility' import FontAwesomeIconWrapper from 'wrappers/FontAwesomeIconWrapper' import ContributorAvatar from 'components/ContributorAvatar' import ActionButton from './ActionButton' import DisplayIcon from './DisplayIcon' import Markdown from './MarkdownWrapper' -// Initial check for mobile screen size -const isMobileInitial = typeof window !== 'undefined' && window.innerWidth < desktopViewMinWidth - const Card = ({ title, url, @@ -29,21 +23,10 @@ const Card = ({ social, tooltipLabel, }: CardProps) => { - const [isMobile, setIsMobile] = useState(isMobileInitial) - - // Resize listener to adjust display based on screen width - useEffect(() => { - const checkMobile = () => { - const mobile = window.innerWidth < desktopViewMinWidth - setIsMobile(mobile) - } - window.addEventListener('resize', checkMobile) - return () => window.removeEventListener('resize', checkMobile) - }, []) - return ( -
-
+
+ {/* Card Header with Badge and Title */} +
{/* Display project level badge (if available) */} {level && ( @@ -56,9 +39,7 @@ const Card = ({ showArrow > @@ -68,7 +49,7 @@ const Card = ({ {/* Project title and link */}

+ {/* Icons associated with the project */} - {icons && Object.keys(Icons).some((key) => icons[key]) ? ( -
+ {icons && Object.keys(Icons).some((key) => icons[key]) && ( +
{Object.keys(Icons).map((key, index) => icons[key] ? ( - ) : null} + )}
- {/* Link to project name if provided */} + + {/* Project name link (if provided) */} {projectName && ( - + {projectName} )} - {/* Render project summary using Markdown */} - -
0 - ? 'flex w-full flex-col gap-2 pr-4' - : 'flex w-full items-center justify-between' - } - > - {/* Render top contributors as avatars */} -
- {topContributors?.map((contributor, index) => ( - - ))} -
- {!social || social.length === 0 ? ( -
+ + {/* Project summary */} + + + {/* Bottom section with social links, contributors and action button */} +
+ {/* Social icons section */} + {social && social.length > 0 && ( +
+
+ {social.map((item) => ( + + + + ))} +
+
+ )} + + {/* Flexible bottom row with contributors and action button */} +
+ {/* Contributors section */} +
+ {topContributors?.map((contributor, index) => ( + + ))} +
+ + {/* Action Button */} +
{button.icon} {button.label}
- ) : ( -
-
- {/* Render social links if available */} - {social && social.length > 0 && ( -
- {social.map((item) => ( - - - - - - ))} -
- )} - {/* Action Button */} -
- - {button.icon} - {button.label} - -
-
-
- )} +
)