mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-07-23 04:26:57 +00:00
Merge pull request #76 from timothyarmes/fix-scroll
Don't scroll on mobile
This commit is contained in:
Vendored
+2
@@ -7,6 +7,7 @@
|
|||||||
"Échecs",
|
"Échecs",
|
||||||
"Fédération",
|
"Fédération",
|
||||||
"Française",
|
"Française",
|
||||||
|
"kodingdotninja",
|
||||||
"Lente",
|
"Lente",
|
||||||
"localisation",
|
"localisation",
|
||||||
"moveend",
|
"moveend",
|
||||||
@@ -17,6 +18,7 @@
|
|||||||
"spiderfied",
|
"spiderfied",
|
||||||
"Spiderfy",
|
"Spiderfy",
|
||||||
"spiderified",
|
"spiderified",
|
||||||
|
"tailwindcss",
|
||||||
"tournois",
|
"tournois",
|
||||||
"unspiderfied",
|
"unspiderfied",
|
||||||
"unspiderfy"
|
"unspiderfy"
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { useEffect } from "react";
|
|||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import { useAtomValue, useSetAtom, useAtom } from "jotai";
|
import { useAtomValue, useSetAtom, useAtom } from "jotai";
|
||||||
import { twMerge } from "tailwind-merge";
|
import { twMerge } from "tailwind-merge";
|
||||||
|
import { FaExternalLinkAlt } from "react-icons/fa";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
filteredTournamentsListAtom,
|
filteredTournamentsListAtom,
|
||||||
@@ -12,13 +13,12 @@ import {
|
|||||||
debouncedHoveredMapTournamentIdAtom,
|
debouncedHoveredMapTournamentIdAtom,
|
||||||
debouncedHoveredListTournamentIdAtom,
|
debouncedHoveredListTournamentIdAtom,
|
||||||
} from "@/app/atoms";
|
} from "@/app/atoms";
|
||||||
|
import { useBreakpoint } from "@/hooks/tailwind";
|
||||||
|
|
||||||
import SearchBar from "./SearchBar";
|
import SearchBar from "./SearchBar";
|
||||||
import TimeControlFilters from "./TimeControlFilters";
|
import TimeControlFilters from "./TimeControlFilters";
|
||||||
import ScrollToTopButton from "./ScrollToTopButton";
|
import ScrollToTopButton from "./ScrollToTopButton";
|
||||||
|
|
||||||
import { FaExternalLinkAlt } from "react-icons/fa";
|
|
||||||
|
|
||||||
export default function TournamentTable() {
|
export default function TournamentTable() {
|
||||||
const t = useTranslations("Tournaments");
|
const t = useTranslations("Tournaments");
|
||||||
|
|
||||||
@@ -32,15 +32,17 @@ export default function TournamentTable() {
|
|||||||
debouncedHoveredListTournamentIdAtom
|
debouncedHoveredListTournamentIdAtom
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const isLg = useBreakpoint("lg");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (debouncedHoveredMapTournamentId === null) return;
|
if (!isLg || debouncedHoveredMapTournamentId === null) return;
|
||||||
|
|
||||||
const tournamentRow = document.getElementById(
|
const tournamentRow = document.getElementById(
|
||||||
debouncedHoveredMapTournamentId
|
debouncedHoveredMapTournamentId
|
||||||
);
|
);
|
||||||
|
|
||||||
tournamentRow?.scrollIntoView({ behavior: "smooth" });
|
tournamentRow?.scrollIntoView({ behavior: "smooth" });
|
||||||
}, [debouncedHoveredMapTournamentId]);
|
}, [debouncedHoveredMapTournamentId, isLg]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section
|
<section
|
||||||
@@ -87,7 +89,7 @@ export default function TournamentTable() {
|
|||||||
<th className="sticky top-0 bg-teal-600 p-3 text-white dark:bg-gray-600">
|
<th className="sticky top-0 bg-teal-600 p-3 text-white dark:bg-gray-600">
|
||||||
{t("timeControl")}
|
{t("timeControl")}
|
||||||
</th>
|
</th>
|
||||||
<th className="sticky w-[50px] top-0 bg-teal-600 p-3 text-white dark:bg-gray-600"></th>
|
<th className="sticky top-0 w-[50px] bg-teal-600 p-3 text-white dark:bg-gray-600"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import create from "@kodingdotninja/use-tailwind-breakpoint";
|
||||||
|
import resolveConfig from "tailwindcss/resolveConfig";
|
||||||
|
|
||||||
|
import tailwindConfig from "@/tailwind.config.js";
|
||||||
|
const config = resolveConfig(tailwindConfig);
|
||||||
|
|
||||||
|
export const { useBreakpoint } = create(config.theme!.screens);
|
||||||
Generated
+14
@@ -8,6 +8,7 @@
|
|||||||
"name": "client",
|
"name": "client",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@kodingdotninja/use-tailwind-breakpoint": "^0.0.5",
|
||||||
"@next/bundle-analyzer": "^13.4.7",
|
"@next/bundle-analyzer": "^13.4.7",
|
||||||
"@types/node": "20.3.2",
|
"@types/node": "20.3.2",
|
||||||
"@types/react": "18.2.14",
|
"@types/react": "18.2.14",
|
||||||
@@ -515,6 +516,19 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
|
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
|
||||||
"integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw=="
|
"integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw=="
|
||||||
},
|
},
|
||||||
|
"node_modules/@kodingdotninja/use-tailwind-breakpoint": {
|
||||||
|
"version": "0.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@kodingdotninja/use-tailwind-breakpoint/-/use-tailwind-breakpoint-0.0.5.tgz",
|
||||||
|
"integrity": "sha512-7h52zL+l+14u9diyjVcGoS5NRIwrc6euIGlHDwtJXlrR3h31RNyTrOfimy7PJTvS4fFdNgbzyrNcGfhj3sDRfQ==",
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": ">=16.8"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"react": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@next/bundle-analyzer": {
|
"node_modules/@next/bundle-analyzer": {
|
||||||
"version": "13.4.7",
|
"version": "13.4.7",
|
||||||
"resolved": "https://registry.npmjs.org/@next/bundle-analyzer/-/bundle-analyzer-13.4.7.tgz",
|
"resolved": "https://registry.npmjs.org/@next/bundle-analyzer/-/bundle-analyzer-13.4.7.tgz",
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
"cypress": "cypress open"
|
"cypress": "cypress open"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@kodingdotninja/use-tailwind-breakpoint": "^0.0.5",
|
||||||
"@next/bundle-analyzer": "^13.4.7",
|
"@next/bundle-analyzer": "^13.4.7",
|
||||||
"@types/node": "20.3.2",
|
"@types/node": "20.3.2",
|
||||||
"@types/react": "18.2.14",
|
"@types/react": "18.2.14",
|
||||||
|
|||||||
Reference in New Issue
Block a user