Skip to content

Commit

Permalink
[feat] Improve disabled zoom lock text styling (#2173)
Browse files Browse the repository at this point in the history
  • Loading branch information
igorDykhta committed Mar 29, 2023
1 parent 9fc98e8 commit 695bccc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/components/src/map/map-control-panel.tsx
Expand Up @@ -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')};
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 695bccc

Please sign in to comment.