| // src/components/tools/ToolCard.tsx | |
| import { Link } from "react-router-dom"; | |
| import { Download, Star, Sparkles, CheckCircle2, Heart } from "lucide-react"; | |
| import { Tool } from "@/types/tool"; | |
| interface ToolCardProps { | |
| tool: Tool; | |
| isInstalled?: boolean; | |
| isLiked?: boolean; | |
| variant?: "grid" | "list"; | |
| } | |
| export function ToolCard({ tool, isInstalled = false, isLiked = false, variant = "grid" }: ToolCardProps) { | |
| if (variant === "list") { | |
| return ( | |
| <Link | |
| to={`/tools/${tool.id}`} | |
| className="flex flex-wrap items-center gap-4 rounded-2xl border border-slate-200 bg-white p-4 transition hover:shadow-md dark:border-gray-700 dark:bg-gray-800 sm:flex-nowrap" | |
| > | |
| <div className="text-3xl">{tool.icon}</div> | |
| <div className="flex-1 min-w-0"> | |
| <div className="flex items-center gap-2 flex-wrap"> | |
| <h3 className="font-semibold text-slate-900 dark:text-white">{tool.name}</h3> | |
| {tool.isFeatured && <Sparkles className="h-3 w-3 text-amber-500" />} | |
| {tool.requiresPro && ( | |
| <span className="rounded-full bg-gradient-to-r from-amber-500 to-orange-500 px-2 py-0.5 text-[10px] font-medium text-white">Pro</span> | |
| )} | |
| </div> | |
| <p className="text-sm text-slate-500 dark:text-gray-400 line-clamp-1">{tool.description}</p> | |
| <div className="mt-1 flex flex-wrap gap-2"> | |
| {tool.tags.slice(0, 2).map((tag) => ( | |
| <span key={tag} className="rounded-full bg-sky-50 px-2 py-0.5 text-xs text-sky-700 dark:bg-sky-900/20 dark:text-sky-400">#{tag}</span> | |
| ))} | |
| </div> | |
| </div> | |
| <div className="flex items-center gap-3 text-sm text-slate-500 dark:text-gray-400"> | |
| <span className="flex items-center gap-1"><Download className="h-3.5 w-3.5" /> {tool.downloads.toLocaleString()}</span> | |
| <span className="flex items-center gap-1"><Star className="h-3.5 w-3.5 text-amber-500" /> {tool.rating.toFixed(1)}</span> | |
| <span className="flex items-center gap-1"><Heart className={`h-3.5 w-3.5 ${isLiked ? "fill-rose-500 text-rose-500" : ""}`} /> {tool.likes}</span> | |
| </div> | |
| {isInstalled && ( | |
| <div className="rounded-full bg-emerald-50 px-2 py-1 text-xs font-medium text-emerald-700 dark:bg-emerald-900/20 dark:text-emerald-400 whitespace-nowrap"> | |
| <CheckCircle2 className="inline h-3 w-3 mr-1" /> Installed | |
| </div> | |
| )} | |
| </Link> | |
| ); | |
| } | |
| return ( | |
| <Link | |
| to={`/tools/${tool.id}`} | |
| className="group relative rounded-3xl border border-slate-200 bg-white p-5 shadow-sm transition hover:-translate-y-1 hover:shadow-lg dark:border-gray-700 dark:bg-gray-800" | |
| > | |
| {tool.isFeatured && ( | |
| <div className="absolute top-3 right-3"> | |
| <Sparkles className="h-4 w-4 text-amber-500" /> | |
| </div> | |
| )} | |
| <div className="text-3xl">{tool.icon}</div> | |
| <div className="mt-3 flex items-start justify-between gap-2"> | |
| <h3 className="font-semibold text-slate-900 dark:text-white line-clamp-1">{tool.name}</h3> | |
| {tool.requiresPro && ( | |
| <span className="rounded-full bg-gradient-to-r from-amber-500 to-orange-500 px-2 py-0.5 text-[10px] font-medium text-white">Pro</span> | |
| )} | |
| </div> | |
| <p className="mt-2 line-clamp-2 text-sm leading-6 text-slate-600 dark:text-gray-400">{tool.description}</p> | |
| <div className="mt-3 flex flex-wrap gap-1.5"> | |
| {tool.tags.slice(0, 3).map((tag) => ( | |
| <span key={tag} className="rounded-full bg-sky-50 px-2 py-0.5 text-xs text-sky-700 dark:bg-sky-900/20 dark:text-sky-400">#{tag}</span> | |
| ))} | |
| {tool.tags.length > 3 && ( | |
| <span className="text-xs text-slate-400">+{tool.tags.length - 3}</span> | |
| )} | |
| </div> | |
| <div className="mt-4 flex items-center justify-between text-xs text-slate-500 dark:text-gray-400"> | |
| <span className="flex items-center gap-1"><Download className="h-3.5 w-3.5" /> {tool.downloads.toLocaleString()}</span> | |
| <span className="flex items-center gap-1"><Star className="h-3.5 w-3.5 text-amber-500" /> {tool.rating.toFixed(1)}</span> | |
| <span className="flex items-center gap-1"><Heart className={`h-3.5 w-3.5 ${isLiked ? "fill-rose-500 text-rose-500" : ""}`} /> {tool.likes}</span> | |
| </div> | |
| {isInstalled && ( | |
| <div className="mt-3 inline-flex items-center gap-1 rounded-full bg-emerald-50 px-2 py-1 text-xs font-medium text-emerald-700 dark:bg-emerald-900/20 dark:text-emerald-400"> | |
| <CheckCircle2 className="h-3 w-3" /> Installed | |
| </div> | |
| )} | |
| </Link> | |
| ); | |
| } |
Xet Storage Details
- Size:
- 4.64 kB
- Xet hash:
- 26f84eca287a3a41b925c6264e0e12c6ff72e359ac023dc9370a4beec45a408d
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.