Skip to content

Commit 5ad2d5b

Browse files
authored
feat: conditionally render map popover and update dataset menu styles (#378)
1 parent c8f1ddb commit 5ad2d5b

File tree

3 files changed

+33
-31
lines changed

3 files changed

+33
-31
lines changed

apps/frontend/src/components/keplerGl/factories/map/MapPopoverFactory.tsx

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -318,35 +318,37 @@ function MapPopoverFactory(LayerHoverInfo, CoordinateInfo) {
318318

319319
return (
320320
<ThemeProvider theme={lightTheme}>
321-
<FloatingFocusManager context={context} modal={frozen}>
322-
<StyledMapPopover
323-
className={classNames([
324-
'map-popover-container',
325-
expanded && 'expanded',
326-
expanded && !isMobile && 'full-width',
327-
expanded && isMobile && 'full-width-mobile',
328-
])}
329-
ref={refs.setFloating}
330-
style={floatingStyles}
331-
{...getFloatingProps()}
332-
>
333-
<PopoverContent
334-
className={classNames(['map-popover', expanded && 'expanded'])}
335-
expandable={expandable}
336-
maxTooltipFields={maxTooltipFields}
321+
{layerHoverProp.fieldsToShow.length > 0 && (
322+
<FloatingFocusManager context={context} modal={frozen}>
323+
<StyledMapPopover
324+
className={classNames([
325+
'map-popover-container',
326+
expanded && 'expanded',
327+
expanded && !isMobile && 'full-width',
328+
expanded && isMobile && 'full-width-mobile',
329+
])}
330+
ref={refs.setFloating}
331+
style={floatingStyles}
332+
{...getFloatingProps()}
337333
>
338-
{Array.isArray(coordinate) && <CoordinateInfo coordinate={coordinate} zoom={zoom} />}
339-
{layerHoverProp && (
340-
<LayerHoverInfo
341-
{...layerHoverProp}
342-
expanded={expanded}
343-
setExpanded={setExpanded}
344-
setExpandable={setExpandable}
345-
/>
346-
)}
347-
</PopoverContent>
348-
</StyledMapPopover>
349-
</FloatingFocusManager>
334+
<PopoverContent
335+
className={classNames(['map-popover', expanded && 'expanded'])}
336+
expandable={expandable}
337+
maxTooltipFields={maxTooltipFields}
338+
>
339+
{Array.isArray(coordinate) && <CoordinateInfo coordinate={coordinate} zoom={zoom} />}
340+
{layerHoverProp && (
341+
<LayerHoverInfo
342+
{...layerHoverProp}
343+
expanded={expanded}
344+
setExpanded={setExpanded}
345+
setExpandable={setExpandable}
346+
/>
347+
)}
348+
</PopoverContent>
349+
</StyledMapPopover>
350+
</FloatingFocusManager>
351+
)}
350352
</ThemeProvider>
351353
);
352354
};

apps/frontend/src/components/map-menu/DatasetMenu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ const ToggleVisibilityMenuIcon = styled(({ visible, ...props }) => (
1818
padding: 3px 7px 3px 7px;
1919
border: 1px solid black;
2020
border-radius: 17px;
21-
background-color: ${({ visible }) => (visible ? 'white' : 'black')};
22-
color: ${({ visible }) => (visible ? 'black' : 'white')};
21+
background-color: ${({ visible }) => (visible ? 'white' : 'rgb(230, 230, 230)')};
22+
color: 'black';
2323
font-size: 10px;
2424
`;
2525

apps/frontend/src/components/map-menu/MapMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export const MapMenu = styled(
169169
}
170170
171171
ul li ${MenuSectionHeading}:last-child {
172-
border-bottom: 0;
172+
display: none;
173173
}
174174
175175
ul li ${MenuSectionHeading} + .range-slider__container {

0 commit comments

Comments
 (0)