"use client"; import { getTechIcon } from "./tech-icons"; interface SmartTechIconProps { techId: string; techName: string; className?: string; fallbackStyle?: "initial" | "emoji" | "gradient"; } // Emojis pour certaines technologies populaires const TECH_EMOJIS: Record = { react: "βš›οΈ", vue: "πŸ’š", typescript: "πŸ”·", nextjs: "β–²", nodejs: "🟒", python: "🐍", javascript: "πŸ’›", html: "🧑", css: "πŸ’™", docker: "🐳", kubernetes: "☸️", aws: "☁️", git: "🌿", github: "πŸ™", mongodb: "πŸƒ", postgresql: "🐘", redis: "πŸ”΄", mysql: "🐬", flutter: "πŸ’™", swift: "πŸ¦‰", kotlin: "🟣", java: "β˜•", php: "🐘", ruby: "πŸ’Ž", go: "🐹", rust: "πŸ¦€", csharp: "πŸ’œ", }; export function SmartTechIcon({ techId, techName, className = "w-6 h-6", fallbackStyle = "initial", }: SmartTechIconProps) { // Essayer d'abord l'icΓ΄ne SVG locale const TechIcon = getTechIcon(techId); // Si ce n'est pas l'icΓ΄ne par dΓ©faut, l'utiliser if (TechIcon !== getTechIcon("default")) { return ; } // Sinon, utiliser le style de fallback switch (fallbackStyle) { case "emoji": const emoji = TECH_EMOJIS[techId]; if (emoji) { return (
{emoji}
); } break; case "gradient": const gradientColors = [ "from-blue-500 to-purple-500", "from-green-500 to-blue-500", "from-red-500 to-pink-500", "from-yellow-500 to-orange-500", "from-purple-500 to-indigo-500", ]; const colorIndex = techId.length % gradientColors.length; return (
{techName.charAt(0).toUpperCase()}
); default: // "initial" return (
{techName.charAt(0).toUpperCase()}
); } // Fallback final return (
{techName.charAt(0).toUpperCase()}
); }