Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
react-leaflet-cluster-layer
Advanced tools
Readme
react-leaflet-cluster-layer
provides a simple <ClusterLayer />
component for plotting React components as markers and clusters in a react-leaflet
map.
import React from 'react';
import { render } from 'react-dom';
import { Map, Marker, Popup, TileLayer } from 'react-leaflet';
import ClusterLayer from 'react-leaflet-cluster-layer';
const position = { lng: -122.673447, lat: 45.522558 };
const markers = [
{
position: { lng: -122.673447, lat: 45.5225581 },
text: 'Voodoo Doughnut',
},
{
position: { lng: -122.6781446, lat: 45.5225512 },
text: 'Bailey\'s Taproom',
},
{
position: { lng: -122.67535700000002, lat: 45.5192743 },
text: 'Barista'
}
];
class ExampleClusterComponent extends React.Component {
render() {
const style = {
border: 'solid 2px darkgrey',
borderRadius: '8px',
backgroundColor: 'white',
padding: '1em',
textAlign: 'center'
};
const cluster = this.props.cluster;
if (cluster.markers.length == 1) {
return (
<div style={style} >{cluster.markers[0].text}</div>
);
}
return (
<div style={style}>{cluster.markers.length} items</div>
);
}
}
const map = (
<Map center={position} zoom={13}>
<ClusterLayer
markers={markers}
clusterComponent={ExampleClusterComponent} />
<TileLayer
url='http://{s}.tile.osm.org/{z}/{x}/{y}.png'
attribution='© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
/>
</Map>
);
render(map, document.getElementById('app'));
The ClusterLayer
component takes the following props:
markers
: an array of objects that expose the properties defined in the Marker
typeclusterComponent
: (required) the React component to be rendered for each marker and cluster, this component will receive the following props
cluster
: a Cluster
object, as defined by the Cluster Flow typestyle
: a style object for positioningmap
: the Leaflet map object from the react-leaflet
MapLayer
...propsForClusters
: the component will also receive the properties of propsForClusters
as propspropsForClusters
: props to pass on to marker and cluster componentsgridSize
: optional prop to control how bounds of clusters expand while being generated (default: 60)minClusterSize
: optional prop to enforce a minimum cluster size (default: 2)To try the example:
npm install
in the root of your cloned repositorynpm run example
See CONTRIBUTING.md
react-leaflet-cluster-layer
is MIT licensed.
See LICENSE.md for details.
FAQs
A custom layer for react-leaflet that makes plotting and clustering react components simple
The npm package react-leaflet-cluster-layer receives a total of 17 weekly downloads. As such, react-leaflet-cluster-layer popularity was classified as not popular.
We found that react-leaflet-cluster-layer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.