Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[Examples] update replace-component example (#1557)
Shan He62d03ab26c50
diff --git a/examples/replace-component/src/app.js b/examples/replace-component/src/app.jsindex b261a6230..57586d45a 100644--- a/examples/replace-component/src/app.js+++ b/examples/replace-component/src/app.js@@ -34,7 +34,7 @@ import {PanelHeaderFactory,PanelToggleFactory,CustomPanelsFactory,- LayerHoverInfoFactory,+ MapPopoverFactory,injectComponents} from 'kepler.gl/components';@@ -42,7 +42,7 @@ import CustomPanelHeaderFactory from './components/panel-header';import CustomSidebarFactory from './components/side-bar';import CustomPanelToggleFactory from './components/panel-toggle';import CustomSidePanelFactory from './components/custom-panel';-import CustomLayerHoverInfoFactory from './components/custom-layer-hover';+import CustomMapPopoverFactory from './components/custom-map-popover';const StyledMapConfigDisplay = styled.div`position: absolute;@@ -64,7 +64,7 @@ const KeplerGl = injectComponents([[PanelHeaderFactory, CustomPanelHeaderFactory],[PanelToggleFactory, CustomPanelToggleFactory],[CustomPanelsFactory, CustomSidePanelFactory],- [LayerHoverInfoFactory, CustomLayerHoverInfoFactory]+ [MapPopoverFactory, CustomMapPopoverFactory]]);class App extends Component {diff --git a/examples/replace-component/src/components/custom-layer-hover.js b/examples/replace-component/src/components/custom-map-popover.jssimilarity index 73%rename from examples/replace-component/src/components/custom-layer-hover.jsrename to examples/replace-component/src/components/custom-map-popover.jsindex aca27a860..24305bb60 100644--- a/examples/replace-component/src/components/custom-layer-hover.js+++ b/examples/replace-component/src/components/custom-map-popover.js@@ -19,20 +19,20 @@// THE SOFTWARE.import React from 'react';-import {LayerHoverInfoFactory} from 'kepler.gl/components';+import {MapPopoverFactory} from 'kepler.gl/components';-const CustomLayerHoverInfoFactory = (...deps) => {- const LayerHoverInfo = LayerHoverInfoFactory(...deps);- const LayerHoverInfoWrapper = props => {+const CustomMapPopoverFactory = (...deps) => {+ const MapPopover = MapPopoverFactory(...deps);+ const MapPopoverWrapper = props => {// Disable tooltip for point layer- if (props.layer?.id === 'point_layer') {+ if (props.layerHoverProp?.layer?.id === 'point_layer') {return null;}- return <LayerHoverInfo {...props} />;+ return <MapPopover {...props} />;};- return LayerHoverInfoWrapper;+ return MapPopoverWrapper;};-CustomLayerHoverInfoFactory.deps = LayerHoverInfoFactory.deps;-export default CustomLayerHoverInfoFactory;+CustomMapPopoverFactory.deps = MapPopoverFactory.deps;+export default CustomMapPopoverFactory;diff --git a/examples/replace-component/src/data/sample-data.js b/examples/replace-component/src/data/sample-data.jsindex b364e6557..2e5e81f0c 100644--- a/examples/replace-component/src/data/sample-data.js+++ b/examples/replace-component/src/data/sample-data.js@@ -31,7 +31,8 @@ export const config = {label: 'Trees',color: [69, 138, 70],columns: {lat: 'Location_latitude', lng: 'Location_longitude', altitude: null},- isVisible: true+ isVisible: true,+ highlightColor: [255, 0, 0, 255]},visualChannels: {sizeField: {name: 'Plan', type: 'integer'}