Skip to content

Commit 6481462

Browse files
committed
bring back images
1 parent 93a4e44 commit 6481462

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/app/PuzzleClient.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
} from 'react';
99

1010
import clsx from 'clsx';
11+
import Image from 'next/image';
1112

1213
function useGridSize() {
1314
const [gridSize, setGridSize] = useState(3);
@@ -424,13 +425,13 @@ export default function PuzzleClient() {
424425
// Render puzzle
425426
// ------------------------------------------------------
426427
return (
427-
<div style={{ width: 400, margin: "20px auto" }}>
428+
<div className="min-h-screen w-screen flex items-center justify-center">
428429
<div
430+
className="border"
429431
style={{
430432
position: "relative",
431433
width: gridSize * tileSize,
432434
height: gridSize * tileSize,
433-
border: "1px solid #999",
434435
}}
435436
>
436437
{/* Bottom layer: NxN facts */}
@@ -453,14 +454,12 @@ export default function PuzzleClient() {
453454
style={{
454455
width: tileSize,
455456
height: tileSize,
456-
backgroundColor: "#fff",
457-
border: "1px solid #444",
458457
boxSizing: "border-box",
459458
transform: `translate(${baseX}px, ${baseY}px)`,
460459
}}
461460
>
462461
<div
463-
className="text-sm text-center [&_a]:cursor-pointer [&_a]:text-primary [&_a]:underline [&_a]:pointer-events-auto hover:[&_a]:opacity-70 px-1"
462+
className="text-sm text-center select-none [&_a]:cursor-pointer [&_a]:text-primary [&_a]:underline [&_a]:pointer-events-auto hover:[&_a]:opacity-70 px-1"
464463
style={{
465464
display: "-webkit-box",
466465
WebkitLineClamp: 4,
@@ -494,7 +493,7 @@ export default function PuzzleClient() {
494493
// If isDraggingTile[i] => no transition
495494
// else transition 200ms => for click or final snap
496495
const tileClasses = clsx(
497-
"absolute pointer-events-auto draggable",
496+
"absolute pointer-events-auto draggable border",
498497
!isDraggingTile[i] &&
499498
"transition-transform duration-200 ease-in-out"
500499
);
@@ -505,24 +504,28 @@ export default function PuzzleClient() {
505504
className={clsx(
506505
tileClasses,
507506
isDraggingTile[i]
508-
? "cursor-grabbing opacity-70"
507+
? "cursor-grabbing"
509508
: canMove
510-
? "cursor-grab hover:opacity-70"
509+
? "cursor-grab"
511510
: "cursor-default"
512511
)}
513512
style={{
514513
width: tileSize,
515514
height: tileSize,
516515
backgroundColor: "#fff",
517-
border: "1px solid #444",
518516
boxSizing: "border-box",
519517
transform: `translate(${baseX + off.x}px, ${baseY + off.y}px)`,
520518
}}
521519
onPointerDown={(e) => handlePointerDown(e, i)}
522520
onPointerMove={(e) => handlePointerMove(e, i)}
523521
onPointerUp={(e) => handlePointerUp(e, i)}
524522
>
525-
{tile}
523+
<Image
524+
src={puzzleImages[tile]}
525+
alt={`Tile ${tile}`}
526+
fill
527+
className="object-cover pointer-events-none"
528+
/>
526529
</div>
527530
);
528531
})}

0 commit comments

Comments
 (0)