Skip to content

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

fix: layer configurator icon update (#3306)

Igor Dykhta8cf4274bf36d
diff --git a/src/components/src/side-panel/layer-panel/layer-panel-header.tsx b/src/components/src/side-panel/layer-panel/layer-panel-header.tsx
index a758b3ce7..4e729d1e8 100644
--- a/src/components/src/side-panel/layer-panel/layer-panel-header.tsx
+++ b/src/components/src/side-panel/layer-panel/layer-panel-header.tsx
@@ -71,6 +71,7 @@ export type LayerPanelHeaderProps = {
visible: ComponentType<Partial<BaseProps>>;
hidden: ComponentType<Partial<BaseProps>>;
enableConfig: ComponentType<Partial<BaseProps>>;
+ disableConfig?: ComponentType<Partial<BaseProps>>;
resetIsValid: ComponentType<Partial<BaseProps>>;
duplicate: ComponentType<Partial<BaseProps>>;
crosshairs: ComponentType<Partial<BaseProps>>;
@@ -280,9 +281,10 @@ export function LayerPanelHeaderActionSectionFactory(
onZoomToLayer,
showRemoveLayer = true,
isEditingLabel,
- // TODO: may not contain all necessary icons for all actions, e.g. actionIcons.duplicate. Need to to merge rather than replace
- actionIcons = defaultActionIcons
+ actionIcons: customActionIcons
} = props;
+ // Merge custom actionIcons with defaults to avoid breaking changes
+ const actionIcons = {...defaultActionIcons, ...customActionIcons};
return (
<HeaderActionSection className="layer-panel__header__actions" isEditingLabel={isEditingLabel}>
<StyledPanelHeaderHiddenActions isConfigActive={isConfigActive}>
@@ -338,7 +340,11 @@ export function LayerPanelHeaderActionSectionFactory(
id={layerId}
tooltip={'tooltip.layerSettings'}
onClick={onToggleEnableConfig}
- IconComponent={actionIcons.enableConfig}
+ IconComponent={
+ isConfigActive
+ ? actionIcons.disableConfig || actionIcons.enableConfig
+ : actionIcons.enableConfig
+ }
/>
</HeaderActionSection>
);
@@ -363,11 +369,21 @@ export const HeaderWarning = ({warning, id}) => (
</StyledHeaderWaring>
);
+const RotatedIcon = styled.div`
+ display: inline-flex;
+ transform: rotate(180deg);
+`;
+
const defaultActionIcons = {
remove: props => <Trash {...props} height="16px" />,
visible: props => <EyeSeen {...props} height="16px" />,
hidden: props => <EyeUnseen {...props} height="16px" />,
enableConfig: props => <ArrowDown {...props} height="18px" />,
+ disableConfig: props => (
+ <RotatedIcon>
+ <ArrowDown {...props} height="18px" />
+ </RotatedIcon>
+ ),
duplicate: props => <Copy {...props} height="14px" />,
resetIsValid: Reset,
crosshairs: props => <ZoomIn {...props} height="14px" />