Skip to content

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

[feat] Apply new legend style (#2831)

Igor Dykhta639c7a5b97e5
diff --git a/src/components/src/common/color-legend.tsx b/src/components/src/common/color-legend.tsx
index 2dcdf9532..3a500da9d 100644
--- a/src/components/src/common/color-legend.tsx
+++ b/src/components/src/common/color-legend.tsx
@@ -28,7 +28,7 @@ const inputCss = css`
`;
const StyledLegend = styled.div<{disableEdit: boolean; isExpanded?: boolean}>`
${props => props.theme.sidePanelScrollBar};
- ${props => (props.isExpanded ? '' : `max-height: 180px;`)};
+ ${props => (props.isExpanded ? '' : `max-height: 156px;`)};
overflow: auto;
margin-bottom: ${GAP}px;
display: grid;
diff --git a/src/components/src/map/map-control-panel.tsx b/src/components/src/map/map-control-panel.tsx
index 798825787..a37f2178c 100644
--- a/src/components/src/map/map-control-panel.tsx
+++ b/src/components/src/map/map-control-panel.tsx
@@ -26,7 +26,7 @@ type StyledMapControlPanelContentProps = {
const StyledMapControlPanelContent = styled.div.attrs({
className: 'map-control__panel-content'
})<StyledMapControlPanelContentProps>`
- ${props => props.theme.dropdownScrollBar};
+ ${props => props.theme.sidePanelScrollBar};
max-height: 500px;
min-height: 100px;
min-width: ${props => props.theme.mapControl.width}px;
@@ -119,6 +119,7 @@ export type MapControlPanelProps = {
onToggleSplitMapViewport?: ActionHandler<typeof toggleSplitMapViewport>;
isViewportUnsyncAllowed?: boolean;
children?: React.ReactNode;
+ className?: string;
};
function MapControlPanelFactory() {
@@ -135,7 +136,8 @@ function MapControlPanelFactory() {
logoComponent,
mapState,
onToggleSplitMapViewport,
- isViewportUnsyncAllowed
+ isViewportUnsyncAllowed,
+ className = 'map-control-panel'
}) => {
const {isViewportSynced, isZoomLocked} = mapState || {};
const onUnlockViewportChange = useCallback(() => {
@@ -148,11 +150,11 @@ function MapControlPanelFactory() {
return (
<StyledMapControlPanel
- className="map-control-panel"
style={{
transform: `scale(${scale})`,
marginBottom: '8px !important'
}}
+ className={className}
>
{mapState?.isSplit && isViewportUnsyncAllowed ? (
<StyledMapControlPanelHeaderSplitViewportsTools>
diff --git a/src/components/src/map/map-legend-panel.tsx b/src/components/src/map/map-legend-panel.tsx
index b6e84676e..a46b41525 100644
--- a/src/components/src/map/map-legend-panel.tsx
+++ b/src/components/src/map/map-legend-panel.tsx
@@ -72,6 +72,7 @@ export type MapLegendPanelProps = {
isViewportUnsyncAllowed?: boolean;
onClickControlBtn?: (e?: MouseEvent) => void;
onLayerVisConfigChange?: (oldLayer: Layer, newVisConfig: Partial<LayerVisConfig>) => void;
+ className: string;
};
function MapLegendPanelFactory(MapControlTooltip, MapControlPanel, MapLegend) {
@@ -93,6 +94,7 @@ function MapLegendPanelFactory(MapControlTooltip, MapControlPanel, MapLegend) {
onToggleSplitMapViewport,
onClickControlBtn,
isViewportUnsyncAllowed = true,
+ className,
onLayerVisConfigChange
}) => {
const mapLegend = mapControls?.mapLegend || ({} as MapControlMapLegend);
@@ -139,7 +141,7 @@ function MapLegendPanelFactory(MapControlTooltip, MapControlPanel, MapLegend) {
const mapControlPanel = (
<MapControlPanel
scale={scale}
- header={'header.layerLegend'}
+ header="header.layerLegend"
isPinned={true}
{...(isPinned
? {
@@ -157,6 +159,7 @@ function MapLegendPanelFactory(MapControlTooltip, MapControlPanel, MapLegend) {
mapState={mapState}
onToggleSplitMapViewport={onToggleSplitMapViewport}
isViewportUnsyncAllowed={isViewportUnsyncAllowed}
+ className={className}
>
<MapLegend
layers={layers}