style: optimize tool thumbnail size and height with 16:10 aspect ratio and compact card metrics

This commit is contained in:
2026-11-12 13:37:42 +05:30
parent 2dda9de00d
commit 5445a8cbee
+19 -19
View File
@@ -297,7 +297,7 @@ function ToolCardImage({ tool, toolName }: { tool: ToolItem; toolName: string })
// 1. VIDEO TOOL (Background Remover)
if (media.type === 'video') {
return (
<div className="relative w-full aspect-square rounded-xl overflow-hidden bg-paper-2 select-none group/img isolate shadow-inner">
<div className="relative w-full aspect-[16/10] max-h-48 sm:max-h-52 rounded-xl overflow-hidden bg-paper-2 select-none group/img isolate shadow-inner">
<video
ref={videoRef}
src={media.videoUrl}
@@ -306,7 +306,7 @@ function ToolCardImage({ tool, toolName }: { tool: ToolItem; toolName: string })
loop
playsInline
preload="none"
className="absolute inset-0 w-full h-full object-cover object-top pointer-events-none"
className="absolute inset-0 w-full h-full object-cover object-center pointer-events-none"
/>
</div>
);
@@ -315,14 +315,14 @@ function ToolCardImage({ tool, toolName }: { tool: ToolItem; toolName: string })
// 2. SINGLE IMAGE (Polaroid, etc.)
if (media.type === 'single') {
return (
<div className="relative w-full aspect-square rounded-xl overflow-hidden bg-paper-2 select-none group/img shadow-inner">
<div className="relative w-full aspect-[16/10] max-h-48 sm:max-h-52 rounded-xl overflow-hidden bg-paper-2 select-none group/img shadow-inner">
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
src={media.image}
alt={toolName}
loading="lazy"
decoding="async"
className="absolute inset-0 w-full h-full object-cover object-top transition-transform duration-500 group-hover:scale-[1.02]"
className="absolute inset-0 w-full h-full object-cover object-center transition-transform duration-500 group-hover:scale-[1.02]"
/>
</div>
);
@@ -335,7 +335,7 @@ function ToolCardImage({ tool, toolName }: { tool: ToolItem; toolName: string })
onPointerDown={handleContainerPointerDown}
onPointerMove={handleContainerPointerMove}
onPointerLeave={handleContainerPointerLeave}
className="relative w-full aspect-square rounded-xl overflow-hidden bg-paper-2 select-none cursor-ew-resize group/img shadow-inner touch-pan-y"
className="relative w-full aspect-[16/10] max-h-48 sm:max-h-52 rounded-xl overflow-hidden bg-paper-2 select-none cursor-ew-resize group/img shadow-inner touch-pan-y"
style={{ touchAction: 'pan-y' }}
>
{/* Enhanced / After Image (Underneath) */}
@@ -345,7 +345,7 @@ function ToolCardImage({ tool, toolName }: { tool: ToolItem; toolName: string })
alt={`${toolName} after`}
loading="lazy"
decoding="async"
className="absolute inset-0 w-full h-full object-cover object-top pointer-events-none"
className="absolute inset-0 w-full h-full object-cover object-center pointer-events-none"
/>
{/* Original / Before Image (Clipped overlay) */}
@@ -362,7 +362,7 @@ function ToolCardImage({ tool, toolName }: { tool: ToolItem; toolName: string })
alt={`${toolName} before`}
loading="lazy"
decoding="async"
className="absolute inset-0 w-full h-full object-cover object-top pointer-events-none"
className="absolute inset-0 w-full h-full object-cover object-center pointer-events-none"
/>
</div>
@@ -382,11 +382,11 @@ function ToolCardImage({ tool, toolName }: { tool: ToolItem; toolName: string })
aria-valuenow={Math.round(splitPos)}
tabIndex={0}
style={{ touchAction: 'none' }}
className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-7 h-7 rounded-full bg-paper-hi text-ink shadow-md flex items-center justify-center border border-rule pointer-events-auto cursor-ew-resize touch-none before:absolute before:-inset-3 before:content-['']"
className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-6 h-6 rounded-full bg-paper-hi text-ink shadow-md flex items-center justify-center border border-rule pointer-events-auto cursor-ew-resize touch-none before:absolute before:-inset-3 before:content-['']"
>
<div className="flex items-center gap-[2px] pointer-events-none">
<div className="w-0 h-0 border-y-[3px] border-y-transparent border-r-[4px] border-r-ink" />
<div className="w-0 h-0 border-y-[3px] border-y-transparent border-l-[4px] border-l-ink" />
<div className="w-0 h-0 border-y-[2.5px] border-y-transparent border-r-[3.5px] border-r-ink" />
<div className="w-0 h-0 border-y-[2.5px] border-y-transparent border-l-[3.5px] border-l-ink" />
</div>
</div>
</div>
@@ -408,16 +408,16 @@ function ToolCard({
const toolSummary = resolveLocalised(tool.summary, locale);
return (
<div className="group studio-sheet p-3.5 sm:p-4 rounded-2xl bg-paper-hi border border-rule shadow-[0_4px_20px_-4px_rgba(0,0,0,0.03)] hover:border-accent hover:shadow-glow motion-safe:transition-[border-color,box-shadow,transform] duration-300 hover:-translate-y-1 flex flex-col justify-between h-full">
<div className="group studio-sheet p-3 sm:p-3.5 rounded-2xl bg-paper-hi border border-rule shadow-[0_4px_20px_-4px_rgba(0,0,0,0.03)] hover:border-accent hover:shadow-glow motion-safe:transition-[border-color,box-shadow,transform] duration-300 hover:-translate-y-1 flex flex-col justify-between h-full">
{/* Image Dominant Preview Frame */}
<ToolCardImage tool={tool} toolName={toolName} />
{/* Info Area: Title, Subtitle, and Direct Action Button */}
<div className="mt-3 flex-1 flex flex-col justify-between space-y-2.5">
<div className="mt-2.5 flex-1 flex flex-col justify-between space-y-2">
<div>
{/* Tool Title */}
<Link href={`/tools/${tool.slug}`} className="block">
<h4 className="text-sm sm:text-base font-display font-bold text-ink tracking-tight leading-snug group-hover:text-accent transition-colors line-clamp-1">
<h4 className="text-sm font-display font-bold text-ink tracking-tight leading-snug group-hover:text-accent transition-colors line-clamp-1">
<AnimatedShinyText>{toolName}</AnimatedShinyText>
</h4>
</Link>
@@ -429,10 +429,10 @@ function ToolCard({
</div>
{/* Action Button Row: Highly Visible Prominent Primary Button */}
<div className="pt-2.5 border-t border-rule">
<div className="pt-2 border-t border-rule">
<Link
href={`/tools/${tool.slug}`}
className="w-full inline-flex items-center justify-between px-3.5 py-2.5 rounded-xl bg-ink hover:bg-accent text-paper-hi font-display font-bold text-xs transition-all duration-200 shadow-xs hover:shadow-md group/btn active:scale-98"
className="w-full inline-flex items-center justify-between px-3 py-2 rounded-xl bg-ink hover:bg-accent text-paper-hi font-display font-bold text-xs transition-all duration-200 shadow-xs hover:shadow-md group/btn active:scale-98"
aria-label={`Open interactive studio for ${toolName}`}
>
<span className="flex items-center gap-1.5">
@@ -562,7 +562,7 @@ export function ToolGridSection({
{resolveLocalised(title, locale)}
</h3>
)}
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3 gap-5 sm:gap-6">
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3 gap-4 sm:gap-5">
{tools.map((tool) => (
<ToolCard key={tool.id} tool={tool} locale={locale} />
))}
@@ -924,7 +924,7 @@ export function ToolGridSection({
</div>
{searchResults.length > 0 ? (
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3 gap-5 sm:gap-6">
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3 gap-4 sm:gap-5">
{searchResults.map((tool) => (
<ToolCard key={tool.id} tool={tool} locale={locale} />
))}
@@ -950,7 +950,7 @@ export function ToolGridSection({
) : activeCategoryItem ? (
/* ================= SINGLE CATEGORY FOCUSED WORKSPACE (SHOWS ALL TOOLS IN CATEGORY) ================= */
<div className="space-y-6">
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3 gap-5 sm:gap-6">
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3 gap-4 sm:gap-5">
{activeCategoryItem.tools.map((tool) => (
<ToolCard
key={tool.id}
@@ -1025,7 +1025,7 @@ export function ToolGridSection({
</div>
{/* Tool Cards Grid: 3 items in a row, at most 2 rows (6 tools) visible */}
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3 gap-5 sm:gap-6">
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3 gap-4 sm:gap-5">
{displayedTools.map((tool) => (
<ToolCard
key={tool.id}