Skip to content

Commit 2a33f5f

Browse files
committed
Improve chile map style
1 parent 5de48e9 commit 2a33f5f

1 file changed

Lines changed: 68 additions & 66 deletions

File tree

src/components/ChileMap.js

Lines changed: 68 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -6,77 +6,79 @@ export default function ChileMap({ cities }) {
66
const [activeCity, setActiveCity] = useState(null);
77

88
return (
9-
<div className="flex flex-col md:flex-row md:items-center justify-between gap-8 mx-auto max-w-6xl px-4">
10-
{/* Contenedor del mapa */}
11-
<div className="w-full md:w-1/2 lg:w-1/3 mx-auto">
12-
<div className="aspect-[3/6] lg:aspect-auto lg:h-[400px] w-full bg-white/10 backdrop-blur-sm rounded-lg p-4 relative">
13-
{/* SVG simplificado del mapa de Chile */}
14-
<svg viewBox="0 0 100 300" className="w-full h-full">
15-
<g transform="translate(-10,0) scale(1.2,1)">
16-
<path
17-
d="M50,20 Q60,50 55,100 Q50,150 60,200 Q70,250 50,280"
18-
fill="none"
19-
stroke="white"
20-
strokeWidth="2"
21-
className="opacity-50"
22-
/>
23-
{cities.map((city) => (
24-
<g
25-
key={city.slug}
26-
onClick={() => setActiveCity(city.slug)}
27-
className="cursor-pointer"
28-
>
29-
<circle
30-
cx={city.mapCoords.x}
31-
cy={city.mapCoords.y}
32-
r={activeCity === city.slug ? 6 : 4}
33-
fill={activeCity === city.slug ? "#FFD700" : "#8A2BE2"}
34-
className="transition-all duration-300"
35-
/>
36-
<text
37-
x={city.mapCoords.x + 8}
38-
y={city.mapCoords.y + 4}
39-
fontSize="8"
40-
fill="white"
41-
className="pointer-events-none"
9+
// Cambiamos el ancho máximo a max-w-4xl para que el contenedor final sea más angosto.
10+
<div className="mx-auto max-w-4xl px-4">
11+
<div className="flex flex-col md:flex-row items-center gap-4">
12+
{/* Contenedor del mapa */}
13+
<div className="w-full md:w-1/2 lg:w-1/2">
14+
<div className="aspect-[3/6] lg:aspect-auto lg:h-[400px] w-full bg-white/10 backdrop-blur-sm rounded-lg p-4 relative">
15+
<svg viewBox="0 0 100 300" className="w-full h-full">
16+
<g transform="translate(-10,0) scale(1.2,1)">
17+
<path
18+
d="M50,20 Q60,50 55,100 Q50,150 60,200 Q70,250 50,280"
19+
fill="none"
20+
stroke="white"
21+
strokeWidth="2"
22+
className="opacity-50"
23+
/>
24+
{cities.map((city) => (
25+
<g
26+
key={city.slug}
27+
onClick={() => setActiveCity(city.slug)}
28+
className="cursor-pointer"
4229
>
43-
{city.name}
44-
</text>
45-
</g>
46-
))}
47-
</g>
48-
</svg>
30+
<circle
31+
cx={city.mapCoords.x}
32+
cy={city.mapCoords.y}
33+
r={activeCity === city.slug ? 6 : 4}
34+
fill={activeCity === city.slug ? "#FFD700" : "#8A2BE2"}
35+
className="transition-all duration-300"
36+
/>
37+
<text
38+
x={city.mapCoords.x + 8}
39+
y={city.mapCoords.y + 4}
40+
fontSize="8"
41+
fill="white"
42+
className="pointer-events-none"
43+
>
44+
{city.name}
45+
</text>
46+
</g>
47+
))}
48+
</g>
49+
</svg>
50+
</div>
4951
</div>
50-
</div>
5152

52-
{/* Lista de ciudades, centrada verticalmente */}
53-
<div className="w-full md:w-1/2 lg:w-1/3 flex flex-col justify-center mt-6 md:mt-0 space-y-4">
54-
{cities.map((city) => (
55-
<Link
56-
href={`/${city.slug}`}
57-
key={city.slug}
58-
className={`block p-4 rounded-lg transition-all duration-300
59-
${
60-
activeCity === city.slug
61-
? "bg-purple-700 transform scale-105"
62-
: "bg-black/20 hover:bg-black/30"
63-
}`}
64-
onMouseEnter={() => setActiveCity(city.slug)}
65-
>
66-
<div className="flex items-center space-x-3">
67-
<div
68-
className={`w-3 h-3 rounded-full ${
69-
activeCity === city.slug ? "bg-yellow-400" : "bg-purple-500"
53+
{/* Lista de ciudades, centradas verticalmente */}
54+
<div className="w-full md:w-1/2 lg:w-1/2 flex flex-col justify-center space-y-4">
55+
{cities.map((city) => (
56+
<Link
57+
href={`/${city.slug}`}
58+
key={city.slug}
59+
className={`block p-4 rounded-lg transition-all duration-300
60+
${
61+
activeCity === city.slug
62+
? "bg-purple-700 transform scale-105"
63+
: "bg-black/20 hover:bg-black/30"
7064
}`}
71-
></div>
72-
<div>
73-
<h3 className="font-bold">{city.name}</h3>
74-
<p className="text-sm opacity-80">{city.date}</p>
65+
onMouseEnter={() => setActiveCity(city.slug)}
66+
>
67+
<div className="flex items-center space-x-3">
68+
<div
69+
className={`w-3 h-3 rounded-full ${
70+
activeCity === city.slug ? "bg-yellow-400" : "bg-purple-500"
71+
}`}
72+
></div>
73+
<div>
74+
<h3 className="font-bold">{city.name}</h3>
75+
<p className="text-sm opacity-80">{city.date}</p>
76+
</div>
7577
</div>
76-
</div>
77-
</Link>
78-
))}
78+
</Link>
79+
))}
80+
</div>
7981
</div>
8082
</div>
8183
);
82-
}
84+
}

0 commit comments

Comments
 (0)