|
9 | 9 | handleResetActiveTooltip
|
10 | 10 | } from './map-tooltip.svelte';
|
11 | 11 | import { createMap } from 'svg-dotted-map';
|
12 |
| - import { Icon } from '../ui'; |
| 12 | + import { browser } from '$app/environment'; |
13 | 13 |
|
14 | 14 | let activeSegment = $state<string>('pop-locations');
|
15 | 15 | let activeMarkers = $derived(pins[activeSegment as PinSegment]);
|
|
86 | 86 | class="relative mx-auto my-10 h-fit w-full max-w-5xl origin-bottom transform-[perspective(25px)_rotateX(1deg)_scale3d(1.2,_1.2,_1)] transition-all [scrollbar-width:none] md:my-0 md:-translate-x-20"
|
87 | 87 | use:mousePosition
|
88 | 88 | >
|
89 |
| - <svg viewBox={`0 0 ${height * 2} ${height}`}> |
90 |
| - <defs> |
91 |
| - <mask id="map"> |
92 |
| - {#each points as point} |
93 |
| - <ellipse |
94 |
| - cx={point.x} |
95 |
| - cy={point.y} |
96 |
| - rx={radius} |
97 |
| - ry={radius * 1.25} |
98 |
| - fill="white" |
99 |
| - /> |
100 |
| - {/each} |
101 |
| - </mask> |
102 |
| - </defs> |
103 |
| - {#each points as point} |
104 |
| - <ellipse |
105 |
| - cx={point.x} |
106 |
| - cy={point.y} |
107 |
| - rx={radius} |
108 |
| - ry={radius * 1.25} |
109 |
| - fill={theme === 'dark' ? 'rgba(255,255,255,.1)' : '#dadadd'} |
110 |
| - /> |
111 |
| - {/each} |
112 |
| - {#each markers as marker} |
113 |
| - <g |
114 |
| - role="tooltip" |
115 |
| - class="animate-fade-in outline-none" |
116 |
| - onmouseover={() => |
117 |
| - handleSetActiveTooltip( |
118 |
| - marker.city, |
119 |
| - marker.code, |
120 |
| - marker.available, |
121 |
| - marker.date |
122 |
| - )} |
123 |
| - onfocus={() => |
124 |
| - handleSetActiveTooltip( |
125 |
| - marker.city, |
126 |
| - marker.code, |
127 |
| - marker.available, |
128 |
| - marker.date |
129 |
| - )} |
130 |
| - onblur={() => handleResetActiveTooltip()} |
131 |
| - onmouseout={() => handleResetActiveTooltip()} |
132 |
| - data-region={slugify(marker.city)} |
133 |
| - > |
134 |
| - <circle cx={marker.x} cy={marker.y} r={radius * 1.25} class="fill-accent" /> |
135 |
| - <circle cx={marker.x} cy={marker.y} r={radius * 0.5} class="fill-white" /> |
136 |
| - <circle |
137 |
| - cx={marker.x} |
138 |
| - cy={marker.y} |
139 |
| - r={radius * 4} |
140 |
| - class="fill-transparent" |
| 89 | + {#if browser} |
| 90 | + <svg viewBox={`0 0 ${height * 2} ${height}`}> |
| 91 | + <defs> |
| 92 | + <mask id="map"> |
| 93 | + {#each points as point} |
| 94 | + <ellipse |
| 95 | + cx={point.x} |
| 96 | + cy={point.y} |
| 97 | + rx={radius} |
| 98 | + ry={radius * 1.25} |
| 99 | + fill="white" |
| 100 | + /> |
| 101 | + {/each} |
| 102 | + </mask> |
| 103 | + </defs> |
| 104 | + {#each points as point} |
| 105 | + <ellipse |
| 106 | + cx={point.x} |
| 107 | + cy={point.y} |
| 108 | + rx={radius} |
| 109 | + ry={radius * 1.25} |
| 110 | + fill={theme === 'dark' ? 'rgba(255,255,255,.1)' : '#dadadd'} |
141 | 111 | />
|
142 |
| - </g> |
143 |
| - {/each} |
144 |
| - </svg> |
| 112 | + {/each} |
| 113 | + {#each markers as marker} |
| 114 | + <g |
| 115 | + role="tooltip" |
| 116 | + class="animate-fade-in outline-none" |
| 117 | + onmouseover={() => |
| 118 | + handleSetActiveTooltip( |
| 119 | + marker.city, |
| 120 | + marker.code, |
| 121 | + marker.available, |
| 122 | + marker.date |
| 123 | + )} |
| 124 | + onfocus={() => |
| 125 | + handleSetActiveTooltip( |
| 126 | + marker.city, |
| 127 | + marker.code, |
| 128 | + marker.available, |
| 129 | + marker.date |
| 130 | + )} |
| 131 | + onblur={() => handleResetActiveTooltip()} |
| 132 | + onmouseout={() => handleResetActiveTooltip()} |
| 133 | + data-region={slugify(marker.city)} |
| 134 | + > |
| 135 | + <circle |
| 136 | + cx={marker.x} |
| 137 | + cy={marker.y} |
| 138 | + r={radius * 1.25} |
| 139 | + class="fill-accent" |
| 140 | + /> |
| 141 | + <circle |
| 142 | + cx={marker.x} |
| 143 | + cy={marker.y} |
| 144 | + r={radius * 0.5} |
| 145 | + class="fill-white" |
| 146 | + /> |
| 147 | + <circle |
| 148 | + cx={marker.x} |
| 149 | + cy={marker.y} |
| 150 | + r={radius * 4} |
| 151 | + class="fill-transparent" |
| 152 | + /> |
| 153 | + </g> |
| 154 | + {/each} |
| 155 | + </svg> |
| 156 | + {/if} |
145 | 157 | </div>
|
146 | 158 | </div>
|
147 | 159 | </div>
|
|
0 commit comments