department-of-veterans-affairs/vets-website

View on GitHub
src/applications/facility-locator/components/markers/DivMarker.jsx

Summary

Maintainability
A
0 mins
Test Coverage
import PropTypes from 'prop-types';
import React from 'react';
import { divIcon } from 'leaflet';
import { Marker } from 'react-leaflet';
import { renderToStaticMarkup } from 'react-dom/server';

export default function DivMarker(props) {
  const { className, children, position, onClick = () => {} } = props;
  const icon = divIcon({
    className,
    html: renderToStaticMarkup(children),
  });

  return <Marker icon={icon} position={position} onClick={onClick} />;
}

DivMarker.propTypes = {
  className: PropTypes.string,
  popupContent: PropTypes.element,
};