import { MagicCard } from "@/components/magicui/magic-card" import { BASE_URL } from "@/constants" import type { Icon } from "@/types/icons" import Image from "next/image" import Link from "next/link" import { useState } from "react" export function IconCard({ name, data: iconData, matchedAlias, }: { name: string data: Icon matchedAlias?: string }) { const [isLoading, setIsLoading] = useState(true) // Construct URLs for both WebP and the original format const webpSrc = `${BASE_URL}/webp/${name}.webp` const originalSrc = `${BASE_URL}/${iconData.base}/${name}.${iconData.base}` return (
{isLoading && (
)} {/* Use tag for WebP support with fallback */} {/* next/image as the img fallback and for optimization */} {`${name} setIsLoading(false)} // Add sizes prop for responsive optimization if needed, e.g., // sizes="(max-width: 640px) 50vw, (max-width: 1280px) 33vw, 16.6vw" />
{name.replace(/-/g, " ")} {matchedAlias && Alias: {matchedAlias}} ) }