MCPcopy
hub / github.com/ZHO-ZHO-ZHO/Nano-Bananary / renderGrid

Function renderGrid

components/TransformationSelector.tsx:67–87  ·  view source on GitHub ↗
(items: Transformation[])

Source from the content-addressed store, hash-verified

65 };
66
67 const renderGrid = (items: Transformation[]) => (
68 <div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4">
69 {items.map((trans, index) => (
70 <button
71 key={trans.key}
72 draggable={!activeCategory} // Only allow dragging categories
73 onDragStart={(e) => !activeCategory && handleDragStart(e, index)}
74 onDragEnter={(e) => !activeCategory && handleDragEnter(e, index)}
75 onDragEnd={!activeCategory && handleDragEnd}
76 onDragOver={!activeCategory && handleDragOver}
77 onClick={() => handleItemClick(trans)}
78 className={`group flex flex-col items-center justify-center text-center p-4 aspect-square bg-[var(--bg-card)] rounded-xl border border-[var(--border-primary)] hover:border-[var(--accent-primary)] transition-all duration-200 ease-in-out transform hover:-translate-y-1 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-[var(--bg-primary)] focus:ring-[var(--accent-primary)] ${
79 !activeCategory ? 'cursor-grab active:cursor-grabbing' : 'cursor-pointer'
80 } ${dragging && !activeCategory ? 'border-dashed' : ''}`}
81 >
82 <span className="text-4xl mb-2 transition-transform duration-200 group-hover:scale-110">{trans.emoji}</span>
83 <span className="font-semibold text-sm text-[var(--text-primary)]">{t(trans.titleKey)}</span>
84 </button>
85 ))}
86 </div>
87 );
88
89 return (
90 <div className="container mx-auto p-4 md:p-8 animate-fade-in">

Callers 1

TransformationSelectorFunction · 0.85

Calls 4

handleDragStartFunction · 0.85
handleDragEnterFunction · 0.85
handleItemClickFunction · 0.85
tFunction · 0.85

Tested by

no test coverage detected