Skip to content

Commit a3bf861

Browse files
committed
Tweak styles
1 parent 2bcf4e6 commit a3bf861

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

src/app/(main)/community/events/map/meetup-map-popover.tsx renamed to src/app/(main)/community/events/map/map-popover.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,23 @@ export type MeetupMapPointer = {
1010

1111
const meetupNameById = new Map(meetups.map(({ node }) => [node.id, node.name]))
1212

13-
type MeetupMapPopoverProps = {
13+
type MapPopoverProps = {
1414
activeMeetupId: string | null
1515
pointer: MeetupMapPointer
1616
}
1717

18-
export function MeetupMapPopover({ activeMeetupId, pointer }: MeetupMapPopoverProps) {
18+
export function MapPopover({ activeMeetupId, pointer }: MapPopoverProps) {
1919
if (!activeMeetupId || !pointer.visible) return null
2020
const name = meetupNameById.get(activeMeetupId)
2121
if (!name) return null
2222
return (
23-
<div
24-
data-testid="meetup-map-popover"
25-
className="pointer-events-none absolute z-10 hidden min-w-0 -translate-x-1/2 -translate-y-3 whitespace-nowrap rounded border border-neu-100 bg-neu-0 px-2 py-1 text-xs font-medium text-neu-900 shadow-sm group-hover/map:flex"
23+
<span
24+
className="pointer-events-none absolute left-0 top-0 z-10 hidden min-w-0 whitespace-nowrap border border-neu-200/40 bg-neu-0/40 px-2 py-1 text-xs font-medium text-neu-900 shadow-sm backdrop-blur-sm group-hover/map:flex"
2625
style={{
27-
left: pointer.x,
28-
top: pointer.y,
26+
transform: `translate3d(calc(${pointer.x}px - 50%), calc(${pointer.y}px - 50% - 24px), 0)`,
2927
}}
3028
>
3129
{name}
32-
</div>
30+
</span>
3331
)
3432
}

src/app/(main)/community/events/meetups-map.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { useTheme } from "next-themes"
1212
import { meetups } from "@/components/meetups"
1313

1414
import { bootMeetupsMap, type MapHandle, type MarkerPoint } from "./map/engine"
15-
import { MeetupMapPopover, type MeetupMapPointer } from "./map/meetup-map-popover"
15+
import { MapPopover, type MeetupMapPointer } from "./map/map-popover"
1616
import { MapSkeleton } from "./map-skeleton"
1717
import { MeetupsList } from "./meetups-list"
1818
import { asRgbString, MAP_COLORS, MapColors } from "./map/map-colors"
@@ -69,7 +69,9 @@ export function MeetupsMap() {
6969

7070
const handlePointerLeave = () => {
7171
setPointer(previous =>
72-
previous.visible ? { x: previous.x, y: previous.y, visible: false } : previous,
72+
previous.visible
73+
? { x: previous.x, y: previous.y, visible: false }
74+
: previous,
7375
)
7476
}
7577

@@ -139,6 +141,9 @@ export function MeetupsMap() {
139141

140142
return (
141143
<div
144+
onMouseOut={() => {
145+
setActiveMeetupId(null)
146+
}}
142147
className="my-6 flex flex-row-reverse divide-neu-200 border border-neu-200 bg-[--sea] [--sea:--sea-light] dark:divide-neu-50 dark:border-neu-50 dark:[--sea:--sea-dark] max-md:flex-col max-md:divide-y md:h-[592px]"
143148
style={
144149
{
@@ -165,7 +170,7 @@ export function MeetupsMap() {
165170
}}
166171
/>
167172

168-
<MeetupMapPopover activeMeetupId={activeMeetupId} pointer={pointer} />
173+
<MapPopover activeMeetupId={activeMeetupId} pointer={pointer} />
169174

170175
<InfoTip />
171176

0 commit comments

Comments
 (0)