Skip to content

Commit 86cee49

Browse files
committed
Fix tile positioning - align perfectly with grid cells
1 parent e052c15 commit 86cee49

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/App.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,14 @@ const App: React.FC = () => {
304304
<div className="absolute inset-4 pointer-events-none">
305305
<AnimatePresence>
306306
{tiles.map((tile) => {
307-
const tileSize = `calc(25% - 12px)`;
308-
const xPos = `calc(${tile.col * 25}% + ${tile.col * 16}px)`;
309-
const yPos = `calc(${tile.row * 25}% + ${tile.row * 16}px)`;
307+
// Each cell is 25% of container width
308+
// Gap between cells is 16px (gap-4)
309+
// Position = (index * (cell_width + gap))
310+
const cellPercent = 25; // 100% / 4 cells
311+
const gapPx = 16;
312+
const xPos = `calc(${tile.col * cellPercent}% + ${tile.col * gapPx}px)`;
313+
const yPos = `calc(${tile.row * cellPercent}% + ${tile.row * gapPx}px)`;
314+
const tileSize = `calc(${cellPercent}% - ${gapPx}px)`;
310315

311316
return (
312317
<motion.div

0 commit comments

Comments
 (0)