Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[chore] pass through logoComponent to PlotContainer (#3176)

Igor Dykhta5f664c3a538c
diff --git a/src/components/src/map-container.tsx b/src/components/src/map-container.tsx
index 36c4ff235..6b131e1da 100644
--- a/src/components/src/map-container.tsx
+++ b/src/components/src/map-container.tsx
@@ -359,6 +359,9 @@ export interface MapContainerProps {
onDeckRender?: (deckProps: Record<string, unknown>) => Record<string, unknown> | null;
onDeckAfterRender?: (deckProps: Record<string, unknown>) => any;
};
+
+ // Optional: override legend header logo in map controls (used by image export)
+ logoComponent?: React.FC | React.ReactNode;
}
export default function MapContainerFactory(
@@ -1126,6 +1129,7 @@ export default function MapContainerFactory(
mapControls={mapControls}
readOnly={this.props.readOnly}
scale={mapState.scale || 1}
+ logoComponent={this.props.logoComponent}
top={
interactionConfig.geocoder && interactionConfig.geocoder.enabled
? theme.mapControlTop
diff --git a/src/components/src/plot-container.tsx b/src/components/src/plot-container.tsx
index 765ff0aae..7ebd1453f 100644
--- a/src/components/src/plot-container.tsx
+++ b/src/components/src/plot-container.tsx
@@ -91,6 +91,9 @@ interface PlotContainerProps {
// Flags
enableErrorNotification?: boolean;
+
+ // Optional: override legend header logo during export
+ logoComponent?: React.ReactNode;
}
export default function PlotContainerFactory(
@@ -117,7 +120,8 @@ export default function PlotContainerFactory(
addNotification,
// Flags
- enableErrorNotification
+ enableErrorNotification,
+ logoComponent
}: PlotContainerProps) {
const plottingAreaRef = useRef<HTMLDivElement>(null);
const [plotEffects] = useState<Effect[]>(() =>
@@ -288,9 +292,11 @@ export default function PlotContainerFactory(
visState: {
...mapFields.visState,
effects: plotEffects
- }
+ },
+ // allow overriding the legend panel logo in export
+ logoComponent
}),
- [mapFields, scaledMapStyle, newMapState, legend, onMapRender, plotEffects]
+ [mapFields, scaledMapStyle, newMapState, legend, onMapRender, plotEffects, logoComponent]
);
const isSplit = splitMaps.length > 1;