diff --git a/src/components/MaintainerCard.tsx b/src/components/MaintainerCard.tsx index dae903454..921aa183b 100644 --- a/src/components/MaintainerCard.tsx +++ b/src/components/MaintainerCard.tsx @@ -1,13 +1,12 @@ -import { Library, Framework } from '~/libraries' +import type { Framework, Library, LibrarySlim } from '~/libraries' import { frameworkOptions } from '~/libraries/frameworks' +import { fallbackLibraryIcon, libraryIcons } from '~/libraries/icons' import { getRoleInLibrary, Maintainer, getPersonsMaintainerOf, } from '~/libraries/maintainers' -import { useState } from 'react' import { Link } from '@tanstack/react-router' -import { twMerge } from 'tailwind-merge' import { MaintainerAvatarImage } from './MaintainerAvatarImage' function RoleBadge({ @@ -54,19 +53,15 @@ function RoleBadge({ function FrameworkChip({ framework }: { framework: Framework }) { const frameworkOption = frameworkOptions.find((f) => f.value === framework) const bgColor = frameworkOption?.color || 'bg-gray-500' + const textColor = + framework === 'solid' || framework === 'alpine' + ? 'text-white' + : 'text-black' return ( - {frameworkOption?.label || framework} ) @@ -75,52 +70,50 @@ function FrameworkChip({ framework }: { framework: Framework }) { function SpecialtyChip({ specialty }: { specialty: string }) { return ( - {specialty} ) } -function LibraryBadge({ library }: { library: Library }) { - const bgClass = `${library.bgStyle ?? 'bg-category-tooling'}/40` +function LibraryBadge({ library }: { library: LibrarySlim }) { + const Icon = libraryIcons[library.id] ?? fallbackLibraryIcon + const textColor = + library.bgStyle === 'bg-category-tooling' + ? 'text-white dark:text-black' + : 'text-black' + const badgeClass = `inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-semibold ${library.bgStyle} ${textColor}` + const label = ( + <> +