@foundrykit/blocks 1.0.23 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +107 -95
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/components/interactive-regions-map/index.tsx +232 -221
- package/src/index.ts +1 -1
|
@@ -1,173 +1,185 @@
|
|
|
1
|
-
'use client'
|
|
1
|
+
'use client';
|
|
2
2
|
|
|
3
|
-
import React, { useState, useCallback, useMemo } from 'react'
|
|
3
|
+
import React, { useState, useCallback, useMemo } from 'react';
|
|
4
4
|
|
|
5
5
|
export interface Region {
|
|
6
|
-
countries: string[]
|
|
7
|
-
name: string
|
|
8
|
-
color?: string
|
|
9
|
-
href?: string
|
|
6
|
+
countries: string[];
|
|
7
|
+
name: string;
|
|
8
|
+
color?: string;
|
|
9
|
+
href?: string;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export interface InteractiveRegionsMapProps {
|
|
13
|
-
title: string
|
|
14
|
-
content?: string
|
|
15
|
-
regions: Region[]
|
|
16
|
-
onRegionClick?: (region: Region) => void
|
|
17
|
-
onRegionHover?: (region: Region | null) => void
|
|
18
|
-
className?: string
|
|
13
|
+
title: string;
|
|
14
|
+
content?: string;
|
|
15
|
+
regions: Region[];
|
|
16
|
+
onRegionClick?: (region: Region) => void;
|
|
17
|
+
onRegionHover?: (region: Region | null) => void;
|
|
18
|
+
className?: string;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
// Country code to name mapping for the SVG paths
|
|
22
22
|
const COUNTRY_MAPPING: Record<string, string> = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
23
|
+
us: 'united-states',
|
|
24
|
+
ca: 'canada',
|
|
25
|
+
mx: 'mexico',
|
|
26
|
+
br: 'brazil',
|
|
27
|
+
ar: 'argentina',
|
|
28
|
+
gb: 'united-kingdom',
|
|
29
|
+
fr: 'france',
|
|
30
|
+
de: 'germany',
|
|
31
|
+
es: 'spain',
|
|
32
|
+
it: 'italy',
|
|
33
|
+
ru: 'russia',
|
|
34
|
+
cn: 'china',
|
|
35
|
+
in: 'india',
|
|
36
|
+
jp: 'japan',
|
|
37
|
+
au: 'australia',
|
|
38
|
+
za: 'south-africa',
|
|
39
|
+
eg: 'egypt',
|
|
40
|
+
ke: 'kenya',
|
|
41
|
+
mg: 'madagascar',
|
|
42
|
+
iq: 'iraq',
|
|
43
|
+
ir: 'iran',
|
|
44
|
+
sa: 'saudi-arabia',
|
|
45
|
+
};
|
|
46
46
|
|
|
47
47
|
// Reverse mapping for lookup
|
|
48
48
|
const NAME_TO_CODE = Object.entries(COUNTRY_MAPPING).reduce(
|
|
49
49
|
(acc, [code, name]) => ({ ...acc, [name]: code }),
|
|
50
50
|
{} as Record<string, string>
|
|
51
|
-
)
|
|
51
|
+
);
|
|
52
52
|
|
|
53
53
|
export function InteractiveRegionsMap({
|
|
54
|
-
title =
|
|
54
|
+
title = 'Interactive Regions Map',
|
|
55
55
|
content,
|
|
56
56
|
regions = [],
|
|
57
57
|
onRegionClick,
|
|
58
58
|
onRegionHover,
|
|
59
|
-
className =
|
|
59
|
+
className = '',
|
|
60
60
|
}: InteractiveRegionsMapProps) {
|
|
61
|
-
const [hoveredRegion, setHoveredRegion] = useState<string | null>(null)
|
|
62
|
-
const [isLoading, setIsLoading] = useState(false)
|
|
61
|
+
const [hoveredRegion, setHoveredRegion] = useState<string | null>(null);
|
|
62
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
63
63
|
|
|
64
64
|
// Create a map of country codes to regions for efficient lookup
|
|
65
65
|
const countryToRegion = useMemo(() => {
|
|
66
|
-
const mapping: Record<string, Region> = {}
|
|
66
|
+
const mapping: Record<string, Region> = {};
|
|
67
67
|
|
|
68
68
|
regions.forEach(region => {
|
|
69
69
|
region.countries.forEach(country => {
|
|
70
|
-
const countryCode = NAME_TO_CODE[country.toLowerCase()]
|
|
70
|
+
const countryCode = NAME_TO_CODE[country.toLowerCase()];
|
|
71
71
|
if (countryCode) {
|
|
72
|
-
mapping[countryCode] = region
|
|
72
|
+
mapping[countryCode] = region;
|
|
73
73
|
}
|
|
74
|
-
})
|
|
75
|
-
})
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
76
|
|
|
77
|
-
return mapping
|
|
78
|
-
}, [regions])
|
|
77
|
+
return mapping;
|
|
78
|
+
}, [regions]);
|
|
79
79
|
|
|
80
80
|
// Handle country hover
|
|
81
|
-
const handleCountryHover = useCallback(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
81
|
+
const handleCountryHover = useCallback(
|
|
82
|
+
(countryCode: string | null) => {
|
|
83
|
+
if (!countryCode) {
|
|
84
|
+
setHoveredRegion(null);
|
|
85
|
+
onRegionHover?.(null);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const region = countryToRegion[countryCode];
|
|
90
|
+
if (region) {
|
|
91
|
+
setHoveredRegion(region.name);
|
|
92
|
+
onRegionHover?.(region);
|
|
93
|
+
} else {
|
|
94
|
+
setHoveredRegion(null);
|
|
95
|
+
onRegionHover?.(null);
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
[countryToRegion, onRegionHover]
|
|
99
|
+
);
|
|
97
100
|
|
|
98
101
|
// Handle country click
|
|
99
|
-
const handleCountryClick = useCallback(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
onRegionClick
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
102
|
+
const handleCountryClick = useCallback(
|
|
103
|
+
async (countryCode: string) => {
|
|
104
|
+
const region = countryToRegion[countryCode];
|
|
105
|
+
if (!region) return;
|
|
106
|
+
|
|
107
|
+
setIsLoading(true);
|
|
108
|
+
|
|
109
|
+
try {
|
|
110
|
+
if (onRegionClick) {
|
|
111
|
+
onRegionClick(region);
|
|
112
|
+
} else if (region.href) {
|
|
113
|
+
// Use standard navigation instead of Next.js router
|
|
114
|
+
window.location.href = region.href;
|
|
115
|
+
}
|
|
116
|
+
} catch (error) {
|
|
117
|
+
console.error('Navigation error:', error);
|
|
118
|
+
} finally {
|
|
119
|
+
setIsLoading(false);
|
|
111
120
|
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
setIsLoading(false)
|
|
116
|
-
}
|
|
117
|
-
}, [countryToRegion, onRegionClick])
|
|
121
|
+
},
|
|
122
|
+
[countryToRegion, onRegionClick]
|
|
123
|
+
);
|
|
118
124
|
|
|
119
125
|
// Get country fill color based on region
|
|
120
|
-
const getCountryFill = useCallback(
|
|
121
|
-
|
|
122
|
-
|
|
126
|
+
const getCountryFill = useCallback(
|
|
127
|
+
(countryCode: string): string => {
|
|
128
|
+
const region = countryToRegion[countryCode];
|
|
129
|
+
if (!region) return '#e5e7eb'; // gray-200
|
|
123
130
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
131
|
+
if (hoveredRegion && hoveredRegion !== region.name) {
|
|
132
|
+
return region.color ? `${region.color}66` : '#d1d5db'; // semi-transparent or gray-300
|
|
133
|
+
}
|
|
127
134
|
|
|
128
|
-
|
|
129
|
-
|
|
135
|
+
return region.color || '#3b82f6'; // blue-500 default
|
|
136
|
+
},
|
|
137
|
+
[countryToRegion, hoveredRegion]
|
|
138
|
+
);
|
|
130
139
|
|
|
131
140
|
// Check if country is interactive
|
|
132
|
-
const isCountryInteractive = useCallback(
|
|
133
|
-
|
|
134
|
-
|
|
141
|
+
const isCountryInteractive = useCallback(
|
|
142
|
+
(countryCode: string): boolean => {
|
|
143
|
+
return countryCode in countryToRegion;
|
|
144
|
+
},
|
|
145
|
+
[countryToRegion]
|
|
146
|
+
);
|
|
135
147
|
|
|
136
148
|
return (
|
|
137
|
-
<section className={`max-w-6xl
|
|
149
|
+
<section className={`mx-auto flex max-w-6xl flex-col p-6 ${className}`}>
|
|
138
150
|
{/* Header */}
|
|
139
|
-
<div className=
|
|
140
|
-
<h2 className=
|
|
151
|
+
<div className='mb-8 flex flex-col items-center justify-center text-center'>
|
|
152
|
+
<h2 className='mb-2 text-3xl font-bold text-gray-900'>{title}</h2>
|
|
141
153
|
{content && (
|
|
142
|
-
<p className=
|
|
154
|
+
<p className='max-w-2xl text-lg text-gray-600'>{content}</p>
|
|
143
155
|
)}
|
|
144
156
|
</div>
|
|
145
157
|
|
|
146
158
|
{/* Map Container */}
|
|
147
|
-
<div className=
|
|
159
|
+
<div className='relative w-full overflow-hidden rounded-lg bg-gray-50 shadow-lg'>
|
|
148
160
|
{isLoading && (
|
|
149
|
-
<div className=
|
|
150
|
-
<div className=
|
|
161
|
+
<div className='absolute inset-0 z-10 flex items-center justify-center bg-white bg-opacity-75'>
|
|
162
|
+
<div className='h-8 w-8 animate-spin rounded-full border-b-2 border-blue-600'></div>
|
|
151
163
|
</div>
|
|
152
164
|
)}
|
|
153
165
|
|
|
154
166
|
<svg
|
|
155
|
-
viewBox=
|
|
156
|
-
className=
|
|
167
|
+
viewBox='0 0 1000 500'
|
|
168
|
+
className='h-auto max-h-96 w-full'
|
|
157
169
|
style={{ maxHeight: '500px' }}
|
|
158
170
|
>
|
|
159
171
|
{/* Simplified world map paths - in production, you'd use a complete world map SVG */}
|
|
160
172
|
|
|
161
173
|
{/* United States */}
|
|
162
174
|
<path
|
|
163
|
-
id=
|
|
164
|
-
d=
|
|
175
|
+
id='us'
|
|
176
|
+
d='M200 200 L350 200 L350 250 L200 250 Z'
|
|
165
177
|
fill={getCountryFill('us')}
|
|
166
|
-
stroke=
|
|
167
|
-
strokeWidth=
|
|
178
|
+
stroke='#374151'
|
|
179
|
+
strokeWidth='0.5'
|
|
168
180
|
className={`transition-all duration-200 ${
|
|
169
181
|
isCountryInteractive('us')
|
|
170
|
-
? 'cursor-pointer hover:stroke-
|
|
182
|
+
? 'cursor-pointer hover:stroke-gray-700 hover:stroke-2'
|
|
171
183
|
: 'cursor-default'
|
|
172
184
|
}`}
|
|
173
185
|
onMouseEnter={() => handleCountryHover('us')}
|
|
@@ -177,14 +189,14 @@ export function InteractiveRegionsMap({
|
|
|
177
189
|
|
|
178
190
|
{/* Canada */}
|
|
179
191
|
<path
|
|
180
|
-
id=
|
|
181
|
-
d=
|
|
192
|
+
id='ca'
|
|
193
|
+
d='M200 150 L350 150 L350 200 L200 200 Z'
|
|
182
194
|
fill={getCountryFill('ca')}
|
|
183
|
-
stroke=
|
|
184
|
-
strokeWidth=
|
|
195
|
+
stroke='#374151'
|
|
196
|
+
strokeWidth='0.5'
|
|
185
197
|
className={`transition-all duration-200 ${
|
|
186
198
|
isCountryInteractive('ca')
|
|
187
|
-
? 'cursor-pointer hover:stroke-
|
|
199
|
+
? 'cursor-pointer hover:stroke-gray-700 hover:stroke-2'
|
|
188
200
|
: 'cursor-default'
|
|
189
201
|
}`}
|
|
190
202
|
onMouseEnter={() => handleCountryHover('ca')}
|
|
@@ -194,14 +206,14 @@ export function InteractiveRegionsMap({
|
|
|
194
206
|
|
|
195
207
|
{/* France */}
|
|
196
208
|
<path
|
|
197
|
-
id=
|
|
198
|
-
d=
|
|
209
|
+
id='fr'
|
|
210
|
+
d='M450 220 L480 220 L480 250 L450 250 Z'
|
|
199
211
|
fill={getCountryFill('fr')}
|
|
200
|
-
stroke=
|
|
201
|
-
strokeWidth=
|
|
212
|
+
stroke='#374151'
|
|
213
|
+
strokeWidth='0.5'
|
|
202
214
|
className={`transition-all duration-200 ${
|
|
203
215
|
isCountryInteractive('fr')
|
|
204
|
-
? 'cursor-pointer hover:stroke-
|
|
216
|
+
? 'cursor-pointer hover:stroke-gray-700 hover:stroke-2'
|
|
205
217
|
: 'cursor-default'
|
|
206
218
|
}`}
|
|
207
219
|
onMouseEnter={() => handleCountryHover('fr')}
|
|
@@ -211,14 +223,14 @@ export function InteractiveRegionsMap({
|
|
|
211
223
|
|
|
212
224
|
{/* Germany */}
|
|
213
225
|
<path
|
|
214
|
-
id=
|
|
215
|
-
d=
|
|
226
|
+
id='de'
|
|
227
|
+
d='M480 220 L510 220 L510 250 L480 250 Z'
|
|
216
228
|
fill={getCountryFill('de')}
|
|
217
|
-
stroke=
|
|
218
|
-
strokeWidth=
|
|
229
|
+
stroke='#374151'
|
|
230
|
+
strokeWidth='0.5'
|
|
219
231
|
className={`transition-all duration-200 ${
|
|
220
232
|
isCountryInteractive('de')
|
|
221
|
-
? 'cursor-pointer hover:stroke-
|
|
233
|
+
? 'cursor-pointer hover:stroke-gray-700 hover:stroke-2'
|
|
222
234
|
: 'cursor-default'
|
|
223
235
|
}`}
|
|
224
236
|
onMouseEnter={() => handleCountryHover('de')}
|
|
@@ -228,14 +240,14 @@ export function InteractiveRegionsMap({
|
|
|
228
240
|
|
|
229
241
|
{/* Spain */}
|
|
230
242
|
<path
|
|
231
|
-
id=
|
|
232
|
-
d=
|
|
243
|
+
id='es'
|
|
244
|
+
d='M420 250 L450 250 L450 280 L420 280 Z'
|
|
233
245
|
fill={getCountryFill('es')}
|
|
234
|
-
stroke=
|
|
235
|
-
strokeWidth=
|
|
246
|
+
stroke='#374151'
|
|
247
|
+
strokeWidth='0.5'
|
|
236
248
|
className={`transition-all duration-200 ${
|
|
237
249
|
isCountryInteractive('es')
|
|
238
|
-
? 'cursor-pointer hover:stroke-
|
|
250
|
+
? 'cursor-pointer hover:stroke-gray-700 hover:stroke-2'
|
|
239
251
|
: 'cursor-default'
|
|
240
252
|
}`}
|
|
241
253
|
onMouseEnter={() => handleCountryHover('es')}
|
|
@@ -245,14 +257,14 @@ export function InteractiveRegionsMap({
|
|
|
245
257
|
|
|
246
258
|
{/* Iraq */}
|
|
247
259
|
<path
|
|
248
|
-
id=
|
|
249
|
-
d=
|
|
260
|
+
id='iq'
|
|
261
|
+
d='M550 280 L570 280 L570 300 L550 300 Z'
|
|
250
262
|
fill={getCountryFill('iq')}
|
|
251
|
-
stroke=
|
|
252
|
-
strokeWidth=
|
|
263
|
+
stroke='#374151'
|
|
264
|
+
strokeWidth='0.5'
|
|
253
265
|
className={`transition-all duration-200 ${
|
|
254
266
|
isCountryInteractive('iq')
|
|
255
|
-
? 'cursor-pointer hover:stroke-
|
|
267
|
+
? 'cursor-pointer hover:stroke-gray-700 hover:stroke-2'
|
|
256
268
|
: 'cursor-default'
|
|
257
269
|
}`}
|
|
258
270
|
onMouseEnter={() => handleCountryHover('iq')}
|
|
@@ -262,14 +274,14 @@ export function InteractiveRegionsMap({
|
|
|
262
274
|
|
|
263
275
|
{/* Iran */}
|
|
264
276
|
<path
|
|
265
|
-
id=
|
|
266
|
-
d=
|
|
277
|
+
id='ir'
|
|
278
|
+
d='M570 280 L600 280 L600 300 L570 300 Z'
|
|
267
279
|
fill={getCountryFill('ir')}
|
|
268
|
-
stroke=
|
|
269
|
-
strokeWidth=
|
|
280
|
+
stroke='#374151'
|
|
281
|
+
strokeWidth='0.5'
|
|
270
282
|
className={`transition-all duration-200 ${
|
|
271
283
|
isCountryInteractive('ir')
|
|
272
|
-
? 'cursor-pointer hover:stroke-
|
|
284
|
+
? 'cursor-pointer hover:stroke-gray-700 hover:stroke-2'
|
|
273
285
|
: 'cursor-default'
|
|
274
286
|
}`}
|
|
275
287
|
onMouseEnter={() => handleCountryHover('ir')}
|
|
@@ -279,14 +291,14 @@ export function InteractiveRegionsMap({
|
|
|
279
291
|
|
|
280
292
|
{/* South Africa */}
|
|
281
293
|
<path
|
|
282
|
-
id=
|
|
283
|
-
d=
|
|
294
|
+
id='za'
|
|
295
|
+
d='M480 380 L510 380 L510 410 L480 410 Z'
|
|
284
296
|
fill={getCountryFill('za')}
|
|
285
|
-
stroke=
|
|
286
|
-
strokeWidth=
|
|
297
|
+
stroke='#374151'
|
|
298
|
+
strokeWidth='0.5'
|
|
287
299
|
className={`transition-all duration-200 ${
|
|
288
300
|
isCountryInteractive('za')
|
|
289
|
-
? 'cursor-pointer hover:stroke-
|
|
301
|
+
? 'cursor-pointer hover:stroke-gray-700 hover:stroke-2'
|
|
290
302
|
: 'cursor-default'
|
|
291
303
|
}`}
|
|
292
304
|
onMouseEnter={() => handleCountryHover('za')}
|
|
@@ -296,14 +308,14 @@ export function InteractiveRegionsMap({
|
|
|
296
308
|
|
|
297
309
|
{/* Kenya */}
|
|
298
310
|
<path
|
|
299
|
-
id=
|
|
300
|
-
d=
|
|
311
|
+
id='ke'
|
|
312
|
+
d='M520 350 L540 350 L540 370 L520 370 Z'
|
|
301
313
|
fill={getCountryFill('ke')}
|
|
302
|
-
stroke=
|
|
303
|
-
strokeWidth=
|
|
314
|
+
stroke='#374151'
|
|
315
|
+
strokeWidth='0.5'
|
|
304
316
|
className={`transition-all duration-200 ${
|
|
305
317
|
isCountryInteractive('ke')
|
|
306
|
-
? 'cursor-pointer hover:stroke-
|
|
318
|
+
? 'cursor-pointer hover:stroke-gray-700 hover:stroke-2'
|
|
307
319
|
: 'cursor-default'
|
|
308
320
|
}`}
|
|
309
321
|
onMouseEnter={() => handleCountryHover('ke')}
|
|
@@ -313,14 +325,14 @@ export function InteractiveRegionsMap({
|
|
|
313
325
|
|
|
314
326
|
{/* Madagascar */}
|
|
315
327
|
<path
|
|
316
|
-
id=
|
|
317
|
-
d=
|
|
328
|
+
id='mg'
|
|
329
|
+
d='M540 380 L555 380 L555 400 L540 400 Z'
|
|
318
330
|
fill={getCountryFill('mg')}
|
|
319
|
-
stroke=
|
|
320
|
-
strokeWidth=
|
|
331
|
+
stroke='#374151'
|
|
332
|
+
strokeWidth='0.5'
|
|
321
333
|
className={`transition-all duration-200 ${
|
|
322
334
|
isCountryInteractive('mg')
|
|
323
|
-
? 'cursor-pointer hover:stroke-
|
|
335
|
+
? 'cursor-pointer hover:stroke-gray-700 hover:stroke-2'
|
|
324
336
|
: 'cursor-default'
|
|
325
337
|
}`}
|
|
326
338
|
onMouseEnter={() => handleCountryHover('mg')}
|
|
@@ -330,14 +342,14 @@ export function InteractiveRegionsMap({
|
|
|
330
342
|
|
|
331
343
|
{/* United Kingdom */}
|
|
332
344
|
<path
|
|
333
|
-
id=
|
|
334
|
-
d=
|
|
345
|
+
id='gb'
|
|
346
|
+
d='M420 200 L440 200 L440 220 L420 220 Z'
|
|
335
347
|
fill={getCountryFill('gb')}
|
|
336
|
-
stroke=
|
|
337
|
-
strokeWidth=
|
|
348
|
+
stroke='#374151'
|
|
349
|
+
strokeWidth='0.5'
|
|
338
350
|
className={`transition-all duration-200 ${
|
|
339
351
|
isCountryInteractive('gb')
|
|
340
|
-
? 'cursor-pointer hover:stroke-
|
|
352
|
+
? 'cursor-pointer hover:stroke-gray-700 hover:stroke-2'
|
|
341
353
|
: 'cursor-default'
|
|
342
354
|
}`}
|
|
343
355
|
onMouseEnter={() => handleCountryHover('gb')}
|
|
@@ -347,14 +359,14 @@ export function InteractiveRegionsMap({
|
|
|
347
359
|
|
|
348
360
|
{/* Italy */}
|
|
349
361
|
<path
|
|
350
|
-
id=
|
|
351
|
-
d=
|
|
362
|
+
id='it'
|
|
363
|
+
d='M480 250 L500 250 L500 280 L480 280 Z'
|
|
352
364
|
fill={getCountryFill('it')}
|
|
353
|
-
stroke=
|
|
354
|
-
strokeWidth=
|
|
365
|
+
stroke='#374151'
|
|
366
|
+
strokeWidth='0.5'
|
|
355
367
|
className={`transition-all duration-200 ${
|
|
356
368
|
isCountryInteractive('it')
|
|
357
|
-
? 'cursor-pointer hover:stroke-
|
|
369
|
+
? 'cursor-pointer hover:stroke-gray-700 hover:stroke-2'
|
|
358
370
|
: 'cursor-default'
|
|
359
371
|
}`}
|
|
360
372
|
onMouseEnter={() => handleCountryHover('it')}
|
|
@@ -364,14 +376,14 @@ export function InteractiveRegionsMap({
|
|
|
364
376
|
|
|
365
377
|
{/* Russia */}
|
|
366
378
|
<path
|
|
367
|
-
id=
|
|
368
|
-
d=
|
|
379
|
+
id='ru'
|
|
380
|
+
d='M550 150 L650 150 L650 200 L550 200 Z'
|
|
369
381
|
fill={getCountryFill('ru')}
|
|
370
|
-
stroke=
|
|
371
|
-
strokeWidth=
|
|
382
|
+
stroke='#374151'
|
|
383
|
+
strokeWidth='0.5'
|
|
372
384
|
className={`transition-all duration-200 ${
|
|
373
385
|
isCountryInteractive('ru')
|
|
374
|
-
? 'cursor-pointer hover:stroke-
|
|
386
|
+
? 'cursor-pointer hover:stroke-gray-700 hover:stroke-2'
|
|
375
387
|
: 'cursor-default'
|
|
376
388
|
}`}
|
|
377
389
|
onMouseEnter={() => handleCountryHover('ru')}
|
|
@@ -381,14 +393,14 @@ export function InteractiveRegionsMap({
|
|
|
381
393
|
|
|
382
394
|
{/* China */}
|
|
383
395
|
<path
|
|
384
|
-
id=
|
|
385
|
-
d=
|
|
396
|
+
id='cn'
|
|
397
|
+
d='M700 220 L750 220 L750 270 L700 270 Z'
|
|
386
398
|
fill={getCountryFill('cn')}
|
|
387
|
-
stroke=
|
|
388
|
-
strokeWidth=
|
|
399
|
+
stroke='#374151'
|
|
400
|
+
strokeWidth='0.5'
|
|
389
401
|
className={`transition-all duration-200 ${
|
|
390
402
|
isCountryInteractive('cn')
|
|
391
|
-
? 'cursor-pointer hover:stroke-
|
|
403
|
+
? 'cursor-pointer hover:stroke-gray-700 hover:stroke-2'
|
|
392
404
|
: 'cursor-default'
|
|
393
405
|
}`}
|
|
394
406
|
onMouseEnter={() => handleCountryHover('cn')}
|
|
@@ -398,14 +410,14 @@ export function InteractiveRegionsMap({
|
|
|
398
410
|
|
|
399
411
|
{/* India */}
|
|
400
412
|
<path
|
|
401
|
-
id=
|
|
402
|
-
d=
|
|
413
|
+
id='in'
|
|
414
|
+
d='M650 280 L700 280 L700 320 L650 320 Z'
|
|
403
415
|
fill={getCountryFill('in')}
|
|
404
|
-
stroke=
|
|
405
|
-
strokeWidth=
|
|
416
|
+
stroke='#374151'
|
|
417
|
+
strokeWidth='0.5'
|
|
406
418
|
className={`transition-all duration-200 ${
|
|
407
419
|
isCountryInteractive('in')
|
|
408
|
-
? 'cursor-pointer hover:stroke-
|
|
420
|
+
? 'cursor-pointer hover:stroke-gray-700 hover:stroke-2'
|
|
409
421
|
: 'cursor-default'
|
|
410
422
|
}`}
|
|
411
423
|
onMouseEnter={() => handleCountryHover('in')}
|
|
@@ -415,14 +427,14 @@ export function InteractiveRegionsMap({
|
|
|
415
427
|
|
|
416
428
|
{/* Japan */}
|
|
417
429
|
<path
|
|
418
|
-
id=
|
|
419
|
-
d=
|
|
430
|
+
id='jp'
|
|
431
|
+
d='M750 240 L770 240 L770 270 L750 270 Z'
|
|
420
432
|
fill={getCountryFill('jp')}
|
|
421
|
-
stroke=
|
|
422
|
-
strokeWidth=
|
|
433
|
+
stroke='#374151'
|
|
434
|
+
strokeWidth='0.5'
|
|
423
435
|
className={`transition-all duration-200 ${
|
|
424
436
|
isCountryInteractive('jp')
|
|
425
|
-
? 'cursor-pointer hover:stroke-
|
|
437
|
+
? 'cursor-pointer hover:stroke-gray-700 hover:stroke-2'
|
|
426
438
|
: 'cursor-default'
|
|
427
439
|
}`}
|
|
428
440
|
onMouseEnter={() => handleCountryHover('jp')}
|
|
@@ -432,14 +444,14 @@ export function InteractiveRegionsMap({
|
|
|
432
444
|
|
|
433
445
|
{/* Australia */}
|
|
434
446
|
<path
|
|
435
|
-
id=
|
|
436
|
-
d=
|
|
447
|
+
id='au'
|
|
448
|
+
d='M750 380 L800 380 L800 420 L750 420 Z'
|
|
437
449
|
fill={getCountryFill('au')}
|
|
438
|
-
stroke=
|
|
439
|
-
strokeWidth=
|
|
450
|
+
stroke='#374151'
|
|
451
|
+
strokeWidth='0.5'
|
|
440
452
|
className={`transition-all duration-200 ${
|
|
441
453
|
isCountryInteractive('au')
|
|
442
|
-
? 'cursor-pointer hover:stroke-
|
|
454
|
+
? 'cursor-pointer hover:stroke-gray-700 hover:stroke-2'
|
|
443
455
|
: 'cursor-default'
|
|
444
456
|
}`}
|
|
445
457
|
onMouseEnter={() => handleCountryHover('au')}
|
|
@@ -449,14 +461,14 @@ export function InteractiveRegionsMap({
|
|
|
449
461
|
|
|
450
462
|
{/* Brazil */}
|
|
451
463
|
<path
|
|
452
|
-
id=
|
|
453
|
-
d=
|
|
464
|
+
id='br'
|
|
465
|
+
d='M300 320 L380 320 L380 400 L300 400 Z'
|
|
454
466
|
fill={getCountryFill('br')}
|
|
455
|
-
stroke=
|
|
456
|
-
strokeWidth=
|
|
467
|
+
stroke='#374151'
|
|
468
|
+
strokeWidth='0.5'
|
|
457
469
|
className={`transition-all duration-200 ${
|
|
458
470
|
isCountryInteractive('br')
|
|
459
|
-
? 'cursor-pointer hover:stroke-
|
|
471
|
+
? 'cursor-pointer hover:stroke-gray-700 hover:stroke-2'
|
|
460
472
|
: 'cursor-default'
|
|
461
473
|
}`}
|
|
462
474
|
onMouseEnter={() => handleCountryHover('br')}
|
|
@@ -466,14 +478,14 @@ export function InteractiveRegionsMap({
|
|
|
466
478
|
|
|
467
479
|
{/* Argentina */}
|
|
468
480
|
<path
|
|
469
|
-
id=
|
|
470
|
-
d=
|
|
481
|
+
id='ar'
|
|
482
|
+
d='M280 400 L320 400 L320 460 L280 460 Z'
|
|
471
483
|
fill={getCountryFill('ar')}
|
|
472
|
-
stroke=
|
|
473
|
-
strokeWidth=
|
|
484
|
+
stroke='#374151'
|
|
485
|
+
strokeWidth='0.5'
|
|
474
486
|
className={`transition-all duration-200 ${
|
|
475
487
|
isCountryInteractive('ar')
|
|
476
|
-
? 'cursor-pointer hover:stroke-
|
|
488
|
+
? 'cursor-pointer hover:stroke-gray-700 hover:stroke-2'
|
|
477
489
|
: 'cursor-default'
|
|
478
490
|
}`}
|
|
479
491
|
onMouseEnter={() => handleCountryHover('ar')}
|
|
@@ -483,14 +495,14 @@ export function InteractiveRegionsMap({
|
|
|
483
495
|
|
|
484
496
|
{/* Mexico */}
|
|
485
497
|
<path
|
|
486
|
-
id=
|
|
487
|
-
d=
|
|
498
|
+
id='mx'
|
|
499
|
+
d='M150 280 L250 280 L250 320 L150 320 Z'
|
|
488
500
|
fill={getCountryFill('mx')}
|
|
489
|
-
stroke=
|
|
490
|
-
strokeWidth=
|
|
501
|
+
stroke='#374151'
|
|
502
|
+
strokeWidth='0.5'
|
|
491
503
|
className={`transition-all duration-200 ${
|
|
492
504
|
isCountryInteractive('mx')
|
|
493
|
-
? 'cursor-pointer hover:stroke-
|
|
505
|
+
? 'cursor-pointer hover:stroke-gray-700 hover:stroke-2'
|
|
494
506
|
: 'cursor-default'
|
|
495
507
|
}`}
|
|
496
508
|
onMouseEnter={() => handleCountryHover('mx')}
|
|
@@ -500,14 +512,14 @@ export function InteractiveRegionsMap({
|
|
|
500
512
|
|
|
501
513
|
{/* Egypt */}
|
|
502
514
|
<path
|
|
503
|
-
id=
|
|
504
|
-
d=
|
|
515
|
+
id='eg'
|
|
516
|
+
d='M500 310 L520 310 L520 330 L500 330 Z'
|
|
505
517
|
fill={getCountryFill('eg')}
|
|
506
|
-
stroke=
|
|
507
|
-
strokeWidth=
|
|
518
|
+
stroke='#374151'
|
|
519
|
+
strokeWidth='0.5'
|
|
508
520
|
className={`transition-all duration-200 ${
|
|
509
521
|
isCountryInteractive('eg')
|
|
510
|
-
? 'cursor-pointer hover:stroke-
|
|
522
|
+
? 'cursor-pointer hover:stroke-gray-700 hover:stroke-2'
|
|
511
523
|
: 'cursor-default'
|
|
512
524
|
}`}
|
|
513
525
|
onMouseEnter={() => handleCountryHover('eg')}
|
|
@@ -517,43 +529,42 @@ export function InteractiveRegionsMap({
|
|
|
517
529
|
|
|
518
530
|
{/* Saudi Arabia */}
|
|
519
531
|
<path
|
|
520
|
-
id=
|
|
521
|
-
d=
|
|
532
|
+
id='sa'
|
|
533
|
+
d='M530 300 L570 300 L570 330 L530 330 Z'
|
|
522
534
|
fill={getCountryFill('sa')}
|
|
523
|
-
stroke=
|
|
524
|
-
strokeWidth=
|
|
535
|
+
stroke='#374151'
|
|
536
|
+
strokeWidth='0.5'
|
|
525
537
|
className={`transition-all duration-200 ${
|
|
526
538
|
isCountryInteractive('sa')
|
|
527
|
-
? 'cursor-pointer hover:stroke-
|
|
539
|
+
? 'cursor-pointer hover:stroke-gray-700 hover:stroke-2'
|
|
528
540
|
: 'cursor-default'
|
|
529
541
|
}`}
|
|
530
542
|
onMouseEnter={() => handleCountryHover('sa')}
|
|
531
543
|
onMouseLeave={() => handleCountryHover(null)}
|
|
532
544
|
onClick={() => handleCountryClick('sa')}
|
|
533
545
|
/>
|
|
534
|
-
|
|
535
546
|
</svg>
|
|
536
547
|
</div>
|
|
537
548
|
|
|
538
549
|
{/* Legend */}
|
|
539
550
|
{regions.length > 0 && (
|
|
540
|
-
<div className=
|
|
551
|
+
<div className='mt-6 flex flex-wrap justify-center gap-4'>
|
|
541
552
|
{regions.map((region, index) => (
|
|
542
553
|
<div
|
|
543
554
|
key={index}
|
|
544
|
-
className={`flex items-center gap-2 px-3 py-2
|
|
555
|
+
className={`flex items-center gap-2 rounded-lg border px-3 py-2 transition-all duration-200 ${
|
|
545
556
|
hoveredRegion === region.name
|
|
546
|
-
? '
|
|
547
|
-
: '
|
|
557
|
+
? 'border-gray-400 bg-gray-100 shadow-md'
|
|
558
|
+
: 'border-gray-200 bg-white'
|
|
548
559
|
}`}
|
|
549
560
|
>
|
|
550
561
|
<div
|
|
551
|
-
className=
|
|
562
|
+
className='h-4 w-4 rounded border border-gray-300'
|
|
552
563
|
style={{
|
|
553
|
-
backgroundColor: region.color || '#3b82f6'
|
|
564
|
+
backgroundColor: region.color || '#3b82f6',
|
|
554
565
|
}}
|
|
555
566
|
/>
|
|
556
|
-
<span className=
|
|
567
|
+
<span className='text-sm font-medium text-gray-700'>
|
|
557
568
|
{region.name}
|
|
558
569
|
</span>
|
|
559
570
|
</div>
|
|
@@ -563,10 +574,10 @@ export function InteractiveRegionsMap({
|
|
|
563
574
|
|
|
564
575
|
{/* Debug info in development */}
|
|
565
576
|
{process.env.NODE_ENV === 'development' && hoveredRegion && (
|
|
566
|
-
<div className=
|
|
577
|
+
<div className='mt-4 rounded border border-yellow-200 bg-yellow-50 p-3 text-sm'>
|
|
567
578
|
<strong>Debug:</strong> Hovering over region: {hoveredRegion}
|
|
568
579
|
</div>
|
|
569
580
|
)}
|
|
570
581
|
</section>
|
|
571
|
-
)
|
|
582
|
+
);
|
|
572
583
|
}
|