diff --git a/app/features/tournament-bracket/components/Bracket/bracket.css b/app/features/tournament-bracket/components/Bracket/bracket.css index 637d69580..c4fe901e4 100644 --- a/app/features/tournament-bracket/components/Bracket/bracket.css +++ b/app/features/tournament-bracket/components/Bracket/bracket.css @@ -8,6 +8,17 @@ padding-block-end: var(--s-6); } +.scrolling-bracket { + padding: var(--s-4) var(--s-6); + max-width: 100%; + max-height: min(1000px, 70vh); + -ms-overflow-style: none; + scrollbar-width: none; + border: 2px solid var(--border); + border-radius: var(--rounded-sm); + overflow: scroll; +} + .bracket__match__header { position: absolute; display: flex; diff --git a/app/features/tournament-bracket/components/Bracket/index.tsx b/app/features/tournament-bracket/components/Bracket/index.tsx index 1a9634bac..979ecfd29 100644 --- a/app/features/tournament-bracket/components/Bracket/index.tsx +++ b/app/features/tournament-bracket/components/Bracket/index.tsx @@ -3,6 +3,8 @@ import type { Bracket as BracketType } from "../../core/Bracket"; import { EliminationBracketSide } from "./Elimination"; import { RoundRobinBracket } from "./RoundRobin"; import { SwissBracket } from "./Swiss"; +import * as React from "react"; +import { useDraggable } from "react-use-draggable-scroll"; export function Bracket({ bracket, @@ -31,7 +33,7 @@ export function Bracket({ if (bracket.type === "single_elimination") { return ( - + + + {children} + + ); + } + + return {children}; +} + +function ScrollableBracketContainer({ + children, +}: { + children: React.ReactNode; +}) { + const ref = React.useRef( + null, + ) as React.MutableRefObject; + const { events } = useDraggable(ref, { + applyRubberBandEffect: true, + }); + return ( -
+
{children}
);