mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-07-23 04:26:57 +00:00
Make scrolling easier on mobile (#67)
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
|||||||
LayerGroup,
|
LayerGroup,
|
||||||
useMapEvent,
|
useMapEvent,
|
||||||
} from "react-leaflet";
|
} from "react-leaflet";
|
||||||
|
import { FaChevronDown } from "react-icons/fa";
|
||||||
import { useAtomValue, useSetAtom } from "jotai";
|
import { useAtomValue, useSetAtom } from "jotai";
|
||||||
|
|
||||||
import "leaflet/dist/leaflet.css";
|
import "leaflet/dist/leaflet.css";
|
||||||
@@ -37,6 +38,11 @@ export default function TournamentMap() {
|
|||||||
const setMapBounds = useSetAtom(mapBoundsAtom);
|
const setMapBounds = useSetAtom(mapBoundsAtom);
|
||||||
const center: LatLngLiteral = { lat: 47.0844, lng: 2.3964 };
|
const center: LatLngLiteral = { lat: 47.0844, lng: 2.3964 };
|
||||||
|
|
||||||
|
const onScrollToTable = () => {
|
||||||
|
const tournamentTable = document.getElementById("tournament-table");
|
||||||
|
tournamentTable?.scrollIntoView({ behavior: "smooth" });
|
||||||
|
};
|
||||||
|
|
||||||
const createLayerGroups = (
|
const createLayerGroups = (
|
||||||
timeControl: TimeControl,
|
timeControl: TimeControl,
|
||||||
colour: string,
|
colour: string,
|
||||||
@@ -110,6 +116,15 @@ export default function TournamentMap() {
|
|||||||
{blitzMarkers}
|
{blitzMarkers}
|
||||||
{otherMarkers}
|
{otherMarkers}
|
||||||
</MapContainer>
|
</MapContainer>
|
||||||
|
|
||||||
|
<div className="flex items-center justify-center lg:hidden">
|
||||||
|
<button
|
||||||
|
className="p-3 text-teal-900 dark:text-white"
|
||||||
|
onClick={onScrollToTable}
|
||||||
|
>
|
||||||
|
<FaChevronDown />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ export default function TournamentTable() {
|
|||||||
const tournamentRow = document.getElementById(
|
const tournamentRow = document.getElementById(
|
||||||
debouncedHoveredMapTournamentId
|
debouncedHoveredMapTournamentId
|
||||||
);
|
);
|
||||||
|
|
||||||
tournamentRow?.scrollIntoView({ behavior: "smooth" });
|
tournamentRow?.scrollIntoView({ behavior: "smooth" });
|
||||||
}, [debouncedHoveredMapTournamentId]);
|
}, [debouncedHoveredMapTournamentId]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user