Make scrolling easier on mobile (#67)

This commit is contained in:
Timothy Armes
2023-07-05 22:00:25 +02:00
parent 052b90ca6e
commit 5b79282f5b
2 changed files with 16 additions and 0 deletions
+15
View File
@@ -8,6 +8,7 @@ import {
LayerGroup,
useMapEvent,
} from "react-leaflet";
import { FaChevronDown } from "react-icons/fa";
import { useAtomValue, useSetAtom } from "jotai";
import "leaflet/dist/leaflet.css";
@@ -37,6 +38,11 @@ export default function TournamentMap() {
const setMapBounds = useSetAtom(mapBoundsAtom);
const center: LatLngLiteral = { lat: 47.0844, lng: 2.3964 };
const onScrollToTable = () => {
const tournamentTable = document.getElementById("tournament-table");
tournamentTable?.scrollIntoView({ behavior: "smooth" });
};
const createLayerGroups = (
timeControl: TimeControl,
colour: string,
@@ -110,6 +116,15 @@ export default function TournamentMap() {
{blitzMarkers}
{otherMarkers}
</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>
);
}