UNPKG

@mattilsynet/designsystem-svelte

Version:

Design system for Mattilsynet

22 lines (21 loc) 892 B
import { MARKER } from './marker'; export const CLICK_POPUP_CLOSE_ID = 'popup-closer'; export function createClickMarkerContent(closeBtnLabel) { return (feature) => { const marker = feature.get(MARKER); return `<div class="layout-flex layout-flex--center-vertical layout-flex--inline p-l-xxxs p-r-0 background-mt-bg-${marker.status}" style="--gap: 0"> <a href="${marker.href}" class="mt-link text-small">${marker.location}</a> <button id="${CLICK_POPUP_CLOSE_ID}" type="button" class="mt-button mt-button--search-clear icon--x-before" aria-label="${closeBtnLabel}"> </button> </div>`; }; } export function setOverlayPosition(map, overlayId, coordinate) { map.getOverlayById(overlayId).setPosition(coordinate); } export function setOverlayContent(map, id, content) { map.getOverlayById(id).getElement().firstChild.innerHTML = content; }