UNPKG

@hackoregon/component-library

Version:

Official repo for Hack Oregon React component library

69 lines (66 loc) 2.21 kB
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } import PropTypes from "prop-types"; import React from "react"; import DeckGL, { PolygonLayer } from "deck.gl"; var BoundaryMap = function BoundaryMap(props) { var viewport = props.viewport, data = props.data, opacity = props.opacity, getPolygon = props.getPolygon, getLineColor = props.getLineColor, getLineWidth = props.getLineWidth, lineWidthScale = props.lineWidthScale, lineJointRounded = props.lineJointRounded, getFillColor = props.getFillColor, filled = props.filled; return React.createElement("div", null, React.createElement(DeckGL, _extends({ className: "DeckGL" }, viewport), React.createElement(PolygonLayer, { id: "polygon-layer", className: "BoundaryMap", pickable: false, data: data, opacity: opacity, getPolygon: getPolygon, getLineColor: getLineColor, getLineWidth: getLineWidth, lineWidthScale: lineWidthScale, lineWidthMinPixels: 1, lineJointRounded: lineJointRounded, stroked: true, getFillColor: getFillColor, filled: filled, updateTriggers: { getLineColor: getLineColor, getFillColor: getFillColor } }))); }; BoundaryMap.propTypes = { viewport: PropTypes.shape({}), data: PropTypes.arrayOf(PropTypes.shape({})).isRequired, opacity: PropTypes.number, getPolygon: PropTypes.func, getLineColor: PropTypes.func, getLineWidth: PropTypes.func, lineWidthScale: PropTypes.number, lineJointRounded: PropTypes.bool, getFillColor: PropTypes.func, filled: PropTypes.bool }; BoundaryMap.defaultProps = { opacity: 1, getLineColor: function getLineColor() { return [255, 0, 0, 255]; }, getLineWidth: function getLineWidth() { return 40; }, lineWidthScale: 1, lineJointRounded: false, getFillColor: function getFillColor() { return [0, 0, 0, 0]; }, filled: false }; export default BoundaryMap;