({
repo,
avatars = [],
totalContributors = 0,
hideOnSmall = false,
hideOnMedium = false,
}: ExampleCardPropsExtended)
| 113 | } |
| 114 | |
| 115 | function ExampleCard({ |
| 116 | repo, |
| 117 | avatars = [], |
| 118 | totalContributors = 0, |
| 119 | hideOnSmall = false, |
| 120 | hideOnMedium = false, |
| 121 | }: ExampleCardPropsExtended) { |
| 122 | // Show top 3 contributors; ensure highest-ranked appears rightmost. |
| 123 | const orderedAvatars = avatars.slice(0, 3).reverse(); |
| 124 | // Badge background color based on GitHub language colors |
| 125 | const badgeBg = LANG_BG_COLORS[repo.language] ?? "#6b7280"; |
| 126 | |
| 127 | return ( |
| 128 | <a |
| 129 | href={`https://github.com/${repo.name}/blob/-/AGENTS.md`} |
| 130 | target="_blank" |
| 131 | rel="noopener noreferrer" |
| 132 | className={`lg:aspect-video bg-white dark:bg-black border border-gray-200 dark:border-gray-700 rounded-lg shadow-sm flex flex-col justify-between p-4 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors ${ |
| 133 | hideOnSmall |
| 134 | ? "hidden lg:flex" |
| 135 | : hideOnMedium |
| 136 | ? "flex md:hidden lg:flex" |
| 137 | : "" |
| 138 | }`} |
| 139 | > |
| 140 | <div> |
| 141 | <h3 |
| 142 | className="font-semibold text-lg leading-snug truncate" |
| 143 | title={repo.name} |
| 144 | > |
| 145 | {repo.name} |
| 146 | </h3> |
| 147 | <p className="mt-1 text-sm text-gray-600 dark:text-gray-400"> |
| 148 | {repo.description} |
| 149 | </p> |
| 150 | </div> |
| 151 | |
| 152 | <div className="flex items-end justify-between mt-4"> |
| 153 | <span |
| 154 | className="text-xs font-semibold px-2 py-0.5 rounded" |
| 155 | style={{ backgroundColor: badgeBg, color: "#fff" }} |
| 156 | > |
| 157 | {repo.language} |
| 158 | </span> |
| 159 | <div className="flex items-center justify-center"> |
| 160 | <div className="flex items-center justify-center -space-x-2"> |
| 161 | {orderedAvatars.length > 0 |
| 162 | ? orderedAvatars.map((url, i) => ( |
| 163 | // eslint-disable-next-line @next/next/no-img-element |
| 164 | <img |
| 165 | key={i} |
| 166 | src={url} |
| 167 | alt="Contributor avatar" |
| 168 | className="w-6 h-6 rounded-full ring-2 ring-white dark:ring-gray-900 object-cover block shrink-0" |
| 169 | /> |
| 170 | )) |
| 171 | : Array.from({ length: 3 }).map((_, i) => ( |
| 172 | <span |
nothing calls this directly
no outgoing calls
no test coverage detected