Skip to content

Commit

Permalink
fix ts err for the deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
eloicasamayor committed Dec 22, 2024
1 parent 56c988f commit 0ea5ce2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/assets/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const Map = ({
onZoomWithButtons={onZoomWithButtons}
zoomToElement={zoomToElement}
selectedCountry={selectedCountry}
wrapperRef={mapRef}
mapRef={mapRef}
/>
<TransformComponent>
<svg
Expand Down
18 changes: 10 additions & 8 deletions src/components/MapControls.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { useEffect } from "react";
import { ReactZoomPanPinchRef, useControls } from "react-zoom-pan-pinch";
import { useControls } from "react-zoom-pan-pinch";

type MapControlsProps = {
isMaxScale: boolean;
isMinScale: boolean;
onZoomWithButtons: Function;
zoomToElement: Function;
selectedCountry: string;
wrapperRef: React.Ref<ReactZoomPanPinchRef>;
mapRef: React.RefObject<HTMLElement>;
};

export const MapControls = ({
Expand All @@ -16,15 +16,17 @@ export const MapControls = ({
onZoomWithButtons,
zoomToElement,
selectedCountry,
wrapperRef,
mapRef,
}: MapControlsProps) => {
const { zoomIn, zoomOut /* resetTransform */ } = useControls();
useEffect(() => {
const countryPath = wrapperRef?.current?.querySelector(
`[title="${selectedCountry}"]`
);
zoomToElement(countryPath);
//(node: HTMLElement | string, scale?: number, animationTime?: number, animationType?: keyof typeof animations) => void;
let countryPath;
if (mapRef?.current) {
countryPath = mapRef?.current?.querySelector(
`[title="${selectedCountry}"]`
);
zoomToElement(countryPath);
}
}, [selectedCountry]);
return (
<div className="tools">
Expand Down

0 comments on commit 0ea5ce2

Please sign in to comment.