Skip to content

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

[feat] Improve disabled zoom lock text styling (#2173)

Igor Dykhta695bcccde315
diff --git a/src/components/src/map/map-control-panel.tsx b/src/components/src/map/map-control-panel.tsx
index f385e5e40..56d90e35c 100644
--- a/src/components/src/map/map-control-panel.tsx
+++ b/src/components/src/map/map-control-panel.tsx
@@ -80,6 +80,15 @@ const StyledSBCenterFlexbox = styled(CenterFlexbox)`
flex-direction: row;
`;
+interface StyledDisableableTextProps {
+ disabled?: boolean;
+}
+
+const StyledDisableableText = styled.span<StyledDisableableTextProps>`
+ opacity: ${props => (props.disabled ? 0.4 : 1)};
+ pointer-events: ${props => (props.disabled ? 'none' : 'all')};
+`;
+
const StyledDisableableSwitch = styled(Switch)`
opacity: ${props => (props.disabled ? 0.4 : 1)};
pointer-events: ${props => (props.disabled ? 'none' : 'all')};
@@ -152,7 +161,9 @@ function MapControlPanelFactory() {
/>
</StyledSBCenterFlexbox>
<StyledSBCenterFlexbox>
- <FormattedMessage id="Sync Zoom" />
+ <StyledDisableableText disabled={mapState?.isViewportSynced}>
+ <FormattedMessage id="Sync Zoom" />
+ </StyledDisableableText>
<StyledDisableableSwitch
checked={mapState?.isZoomLocked}
id="sync-zoom-toggle"