more bracket work
This commit is contained in:
44
src/features/bracket/components/bracket.tsx
Normal file
44
src/features/bracket/components/bracket.tsx
Normal file
@@ -0,0 +1,44 @@
|
||||
import { Flex } from "@mantine/core";
|
||||
import { Match } from "@/features/matches/types";
|
||||
import { MatchCard } from "./match-card";
|
||||
|
||||
interface BracketProps {
|
||||
rounds: Match[][];
|
||||
orders: Record<number, number>;
|
||||
onAnnounce?: (teamOne: any, teamTwo: any) => void;
|
||||
}
|
||||
|
||||
export const Bracket: React.FC<BracketProps> = ({
|
||||
rounds,
|
||||
orders,
|
||||
onAnnounce,
|
||||
}) => {
|
||||
return (
|
||||
<Flex direction="row" gap={24} justify="left" p="xl">
|
||||
{rounds.map((round, roundIndex) => (
|
||||
<Flex
|
||||
key={roundIndex}
|
||||
direction="column"
|
||||
align="center"
|
||||
pos="relative"
|
||||
gap={24}
|
||||
justify="space-around"
|
||||
>
|
||||
{round
|
||||
.filter((match) => !match.bye)
|
||||
.map((match) => {
|
||||
return (
|
||||
<div key={match.lid}>
|
||||
<MatchCard
|
||||
match={match}
|
||||
orders={orders}
|
||||
onAnnounce={onAnnounce}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</Flex>
|
||||
))}
|
||||
</Flex>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user