mapLink
Lights every element sharing key while the host is pointed at or holds focus.
import { mapLink } from "@sdxc/ui/map";View code
// Each row and pin carries mapLink(stay.id), so a row lights its pin and the reverse.
<ul>
{stays.map((stay) => (
<li mix={[mapLink(stay.id)]}>
<a href={`/stays/${stay.id}`}>{stay.name}</a>
</li>
))}
</ul>
<MapCanvas label="Stays in Porto Novo" art={<Town />}>
{stays.map((stay) => (
<MapCanvas.Pin x={stay.x} y={stay.y} label={stay.price} mapKey={stay.id} />
))}
</MapCanvas>
{/* One island links every data-map-key row and pin on the page through mapLinks(). */}
<MapCanvasSync />Usage
Lights every element sharing key while the host is pointed at or holds focus, and keeps
them lit until both the pointer and the focus have left it. The host gets data-map-key
too, so a row and a pin each carrying mapLink light one another.
Signature
mapLink(key: string): MixinDescriptor<HTMLElement>Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
key | string | Yes | Record key, such as a listing id. |
Examples
<li mix={mapLink(stay.id)}><a href={stay.url}>{stay.name}</a></li><MapCanvas.Pin x={120} y={80} label="$182" mapKey={stay.id} />Used with it
The events, constants and types its module publishes, each imported from @sdxc/ui/map too.
Constant
MAP_KEY_ATTRIBUTE
Attribute naming the record a row or pin stands for.
const MAP_KEY_ATTRIBUTE = "data-map-key"Constant
MAP_HIGHLIGHTED_ATTRIBUTE
Attribute present on every element of the record under the pointer or focus.
const MAP_HIGHLIGHTED_ATTRIBUTE = "data-highlighted"