Skip to content

Commit 3eb2689

Browse files
committed
refactor: height of the geomap visualization container
1 parent 4cd12fe commit 3eb2689

File tree

4 files changed

+22
-6
lines changed

4 files changed

+22
-6
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { FC, PropsWithChildren } from "react";
2+
import { useSelector } from "react-redux";
3+
4+
import { getMapHeight } from "./selectors";
5+
6+
export const HeightContainer: FC<PropsWithChildren> = ({ children }) => {
7+
const height = useSelector(getMapHeight);
8+
9+
return <div style={{ height }}>{children}</div>;
10+
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { State } from "@/js/types";
2+
3+
export const getMapHeight = (state: State) => state.chart.height;

vis/js/templates/Geomap/index.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,18 @@ import { FC } from "react";
44
import { MapContainer, ZoomControl } from "react-leaflet";
55

66
import { CONFIG } from "./config";
7+
import { HeightContainer } from "./HeightContainer";
78
import { LayersSwitcher } from "./LayersSwitcher";
89
import { Pins } from "./Pins";
910

1011
const { MAP, ZOOM_CONTROL } = CONFIG;
1112

1213
export const Geomap: FC = () => (
13-
<MapContainer {...MAP} className="geomap_container">
14-
<ZoomControl {...ZOOM_CONTROL} />
15-
<LayersSwitcher />
16-
<Pins />
17-
</MapContainer>
14+
<HeightContainer>
15+
<MapContainer {...MAP} className="geomap_container">
16+
<ZoomControl {...ZOOM_CONTROL} />
17+
<LayersSwitcher />
18+
<Pins />
19+
</MapContainer>
20+
</HeightContainer>
1821
);

vis/stylesheets/modules/_geomap.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* ########### Geomap ########### */
22

33
.geomap_container {
4-
height: 100vh;
4+
height: 100%;
55
width: 100%;
66
z-index: 0;
77
}

0 commit comments

Comments
 (0)