Skip to content

Commit 10b222b

Browse files
author
vbaroni
committed
fix: update color handling for visibility in DatasetMenu and MultiSelectFilter
1 parent 7771657 commit 10b222b

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

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

Lines changed: 12 additions & 4 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' : 'rgb(230, 230, 230)')};
22-
color: 'black';
21+
background-color: ${({ visible }) => (visible ? 'white' : 'black')};
22+
color: ${({ visible }) => (visible ? 'black' : 'white')};
2323
font-size: 10px;
2424
`;
2525

@@ -76,14 +76,22 @@ export const DatasetMenu = ({
7676
};
7777

7878
const hslLayerColor = rgbToHsl(layer.config.color);
79-
const hslColor = !layer.config.isVisible ? rgbToHsl([230, 230, 230]) : hslLayerColor;
79+
const hslColor = !layer.config.isVisible ? rgbToHsl([160, 160, 160]) : hslLayerColor;
8080
const hslCssColor = toCss(hslColor);
8181

82+
const iconStyle = {
83+
backgroundColor: layer.config.isVisible ? `hsl(${hslCssColor})` : 'transparent',
84+
height: 13,
85+
width: 13,
86+
};
87+
8288
return (
8389
<li {...props} className={classNames(['dataset-menu', unfolded ? 'unfolded' : ''])}>
8490
<DatasetMenuHeading as="button" onClick={setUnfolded} role="button" layer={layer}>
8591
<h2>{layer.config.label}</h2>
86-
<MenuIcon style={{ backgroundColor: `hsl(${hslCssColor})`, height: 13, width: 13 }} />
92+
<MenuIcon
93+
style={iconStyle}
94+
/>
8795
</DatasetMenuHeading>
8896
<FoldableItem unfolded={unfolded}>
8997
<MenuSectionHeading

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const MultiSelectFilter = styled(({ idx, filter, setFilter, layer, ...pro
4040
);
4141

4242
const hslLayerColor = rgbToHsl(layer.config.color);
43-
const hslColor = !layer.config.isVisible ? rgbToHsl([230, 230, 230]) : hslLayerColor;
43+
const hslColor = !layer.config.isVisible ? rgbToHsl([160, 160, 160]) : hslLayerColor;
4444
const hslCssColor = toCss(hslColor);
4545

4646
return (

0 commit comments

Comments
 (0)