Skip to content

Commit 89ee1c1

Browse files
committed
fix
1 parent c81c20d commit 89ee1c1

File tree

4 files changed

+64
-144
lines changed

4 files changed

+64
-144
lines changed

src/app/projects/qrcode/Logo.tsx

-59
This file was deleted.

src/app/test/page.tsx

+62-84
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,62 @@
1-
import {
2-
Activity,
3-
Component,
4-
DockIcon,
5-
HomeIcon,
6-
Mail,
7-
Package,
8-
ScrollText,
9-
SunMoon,
10-
} from 'lucide-react';
11-
import { HiddenDock, DockItem, DockLabel } from './dock';
12-
13-
14-
15-
const data = [
16-
{
17-
title: 'Home',
18-
icon: (
19-
<HomeIcon className='h-full w-full text-neutral-600 dark:text-neutral-300' />
20-
),
21-
href: '#',
22-
},
23-
{
24-
title: 'Products',
25-
icon: (
26-
<Package className='h-full w-full text-neutral-600 dark:text-neutral-300' />
27-
),
28-
href: '#',
29-
},
30-
{
31-
title: 'Components',
32-
icon: (
33-
<Component className='h-full w-full text-neutral-600 dark:text-neutral-300' />
34-
),
35-
href: '#',
36-
},
37-
{
38-
title: 'Activity',
39-
icon: (
40-
<Activity className='h-full w-full text-neutral-600 dark:text-neutral-300' />
41-
),
42-
href: '#',
43-
},
44-
{
45-
title: 'Change Log',
46-
icon: (
47-
<ScrollText className='h-full w-full text-neutral-600 dark:text-neutral-300' />
48-
),
49-
href: '#',
50-
},
51-
{
52-
title: 'Email',
53-
icon: (
54-
<Mail className='h-full w-full text-neutral-600 dark:text-neutral-300' />
55-
),
56-
href: '#',
57-
},
58-
{
59-
title: 'Theme',
60-
icon: (
61-
<SunMoon className='h-full w-full text-neutral-600 dark:text-neutral-300' />
62-
),
63-
href: '#',
64-
},
65-
];
66-
67-
export default function AppleStyleDock() {
68-
return (
69-
<div className='absolute bottom-2 left-1/2 max-w-full -translate-x-1/2'>
70-
<HiddenDock className='items-end pb-3'>
71-
{data.map((item, idx) => (
72-
<DockItem
73-
key={idx}
74-
className='aspect-square rounded-full bg-gray-200 dark:bg-neutral-800'
75-
>
76-
<DockLabel>{item.title}</DockLabel>
77-
<DockIcon>{item.icon}</DockIcon>
78-
</DockItem>
79-
))}
80-
</HiddenDock>
81-
</div>
82-
);
83-
}
84-
1+
"use client"; // Indica che il componente deve essere eseguito nel client
2+
3+
import React, { useEffect, useState } from "react";
4+
5+
export default function Grid50x50() {
6+
const gridSize = 50; // Dimensione della griglia
7+
const [position, setPosition] = useState({ x: 0, y: 0 }); // Posizione iniziale del quadratino
8+
const speed = 1; // Velocità del movimento
9+
10+
const squares = Array.from({ length: gridSize * gridSize }, (_, i) => i + 1);
11+
12+
// Funzione per gestire la pressione dei tasti
13+
const handleKeyDown = (e) => {
14+
setPosition((prevPosition) => {
15+
const newPosition = { ...prevPosition };
16+
switch (e.key) {
17+
case "ArrowUp":
18+
if (newPosition.y > 0) newPosition.y -= 1; // Muovi verso l'alto
19+
break;
20+
case "ArrowDown":
21+
if (newPosition.y < gridSize - 1) newPosition.y += 1; // Muovi verso il basso
22+
break;
23+
case "ArrowLeft":
24+
if (newPosition.x > 0) newPosition.x -= 1; // Muovi verso sinistra
25+
break;
26+
case "ArrowRight":
27+
if (newPosition.x < gridSize - 1) newPosition.x += 1; // Muovi verso destra
28+
break;
29+
default:
30+
break;
31+
}
32+
console.log(newPosition);
33+
return newPosition;
34+
});
35+
};
36+
37+
// Aggiungi l'event listener per la pressione dei tasti quando il componente è montato
38+
useEffect(() => {
39+
window.addEventListener("keydown", handleKeyDown);
40+
41+
// Pulisci l'event listener quando il componente è smontato
42+
return () => {
43+
window.removeEventListener("keydown", handleKeyDown);
44+
};
45+
}, []);
46+
47+
return (
48+
<div className="grid-cols-50 grid gap-0">
49+
{squares.map((item, idx) => {
50+
const isActive =
51+
position.x === idx % gridSize &&
52+
position.y === Math.floor(idx / gridSize);
53+
return (
54+
<div
55+
className={`size-2 ${isActive ? "bg-red-300" : "bg-gray-300"}`}
56+
key={idx}
57+
></div>
58+
);
59+
})}
60+
</div>
61+
);
62+
}

src/styles/globals.css

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363

6464
body {
6565
@apply bg-background text-foreground;
66+
6667
}
6768
}
6869

tailwind.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const config = {
2020
extend: {
2121
gridTemplateColumns: {
2222
// Simple 16 column grid
23-
'29': 'repeat(29, minmax(0, 1fr))',
23+
'50': 'repeat(50, minmax(0, 1fr))',
2424
},
2525

2626
borderRadius: {

0 commit comments

Comments
 (0)