Skip to content

Commit ce776a8

Browse files
committed
refactor: update components structure
1 parent 4834d75 commit ce776a8

6 files changed

Lines changed: 23 additions & 6 deletions

File tree

vis/js/templates/Geomap/ControlTabOrder/index.tsx renamed to vis/js/templates/Geomap/GeomapMapBehaviors/ControlTabOrder/index.tsx

File renamed without changes.

vis/js/templates/Geomap/KeyboardZoomController/index.tsx renamed to vis/js/templates/Geomap/GeomapMapBehaviors/KeyboardZoomController/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { FC } from "react";
2+
23
import { useKeyboardZoom } from "./useKeyboardZoom";
34

45
export const KeyboardZoomController: FC = () => {

vis/js/templates/Geomap/KeyboardZoomController/useKeyboardZoom.ts renamed to vis/js/templates/Geomap/GeomapMapBehaviors/KeyboardZoomController/useKeyboardZoom.ts

File renamed without changes.

vis/js/templates/Geomap/SelectionResetHandler/index.tsx renamed to vis/js/templates/Geomap/GeomapMapBehaviors/SelectionResetHandler/index.tsx

File renamed without changes.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { FC } from "react";
2+
3+
import { ControlTabOrder } from "./ControlTabOrder";
4+
import { KeyboardZoomController } from "./KeyboardZoomController";
5+
import { SelectionResetHandler } from "./SelectionResetHandler";
6+
7+
/**
8+
* Why this component is needed?
9+
*
10+
* This component is used to handle the map behaviors.
11+
* For example, when the user clicks on the map, the selection is reset OR
12+
* when the user zooms in or out using the keyboard, the map is zoomed in or out.
13+
*/
14+
export const GeomapMapBehaviors: FC = () => (
15+
<>
16+
<ControlTabOrder />
17+
<SelectionResetHandler />
18+
<KeyboardZoomController />
19+
</>
20+
);

vis/js/templates/Geomap/index.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,17 @@ import { FC } from "react";
44
import { MapContainer } from "react-leaflet";
55

66
import { CONFIG } from "./config";
7-
import { ControlTabOrder } from "./ControlTabOrder";
7+
import { GeomapMapBehaviors } from "./GeomapMapBehaviors";
88
import { HeightContainer } from "./HeightContainer";
9-
import { KeyboardZoomController } from "./KeyboardZoomController";
109
import { Layer } from "./Layer";
1110
import { Pins } from "./Pins";
12-
import { SelectionResetHandler } from "./SelectionResetHandler";
1311
import { ZoomControls } from "./ZoomControls";
1412

1513
export const Geomap: FC = () => (
1614
<HeightContainer>
1715
<MapContainer {...CONFIG} className="geomap_container">
18-
<ControlTabOrder />
19-
<SelectionResetHandler />
16+
<GeomapMapBehaviors />
2017
<ZoomControls />
21-
<KeyboardZoomController />
2218
<Layer />
2319
<Pins />
2420
</MapContainer>

0 commit comments

Comments
 (0)