2025-04-24 20:38:09 +02:00
|
|
|
import { MagicCard } from "@/components/magicui/magic-card"
|
|
|
|
import { BASE_URL } from "@/constants"
|
2025-04-26 13:07:02 +02:00
|
|
|
import { formatIconName } from "@/lib/utils"
|
2025-04-24 20:38:09 +02:00
|
|
|
import type { Icon } from "@/types/icons"
|
|
|
|
import Image from "next/image"
|
|
|
|
import Link from "next/link"
|
|
|
|
|
|
|
|
export function IconCard({
|
|
|
|
name,
|
|
|
|
data: iconData,
|
|
|
|
matchedAlias,
|
|
|
|
}: {
|
|
|
|
name: string
|
|
|
|
data: Icon
|
2025-04-24 22:47:07 +02:00
|
|
|
matchedAlias?: string
|
2025-04-24 20:38:09 +02:00
|
|
|
}) {
|
2025-04-26 13:07:02 +02:00
|
|
|
const formatedIconName = formatIconName(name)
|
2025-04-24 20:38:09 +02:00
|
|
|
return (
|
|
|
|
<MagicCard className="rounded-md shadow-md">
|
|
|
|
<Link prefetch={false} href={`/icons/${name}`} className="group flex flex-col items-center p-3 sm:p-4 cursor-pointer">
|
2025-04-26 13:07:02 +02:00
|
|
|
<div className="relative h-16 w-16 mb-2">
|
|
|
|
<Image
|
2025-05-08 23:55:25 +02:00
|
|
|
src={`${BASE_URL}/${iconData.base}/${iconData.colors?.light || name}.${iconData.base}`}
|
2025-04-26 13:07:02 +02:00
|
|
|
alt={`${name} icon`}
|
|
|
|
fill
|
|
|
|
className="object-contain p-1 group-hover:scale-110 transition-transform duration-300"
|
|
|
|
/>
|
2025-04-24 20:38:09 +02:00
|
|
|
</div>
|
|
|
|
<span className="text-xs sm:text-sm text-center truncate w-full capitalize group- dark:group-hover:text-primary transition-colors duration-200 font-medium">
|
2025-04-26 13:07:02 +02:00
|
|
|
{formatedIconName}
|
2025-04-24 20:38:09 +02:00
|
|
|
</span>
|
|
|
|
</Link>
|
|
|
|
</MagicCard>
|
|
|
|
)
|
|
|
|
}
|