teletilt (#3)
- Context - sync _tilts_ between participants - shiny cards - reconnect clients - updates Settings - re-animate Switches Co-authored-by: Gavin McDonald <gavinmcdoh@gmail.com> Reviewed-on: #3
This commit was merged in pull request #3.
This commit is contained in:
28
components/TarokkaGrid.tsx
Normal file
28
components/TarokkaGrid.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
'use client';
|
||||
|
||||
import { useAppContext } from '@/app/AppContext';
|
||||
import Card from '@/components/Card';
|
||||
import { cardMap } from '@/constants/tarokka';
|
||||
import type {} from '@/types';
|
||||
|
||||
export default function TarokkaGrid() {
|
||||
const { gameData } = useAppContext();
|
||||
const { cards } = gameData;
|
||||
|
||||
// map our five Tarokka cards to their proper locations in a 3x3 grid
|
||||
// common deck cards: left, top, and right
|
||||
// high deck cards: bottom and center
|
||||
const arrangeCards = (_cell: unknown, index: number) => cards[cardMap[index]];
|
||||
|
||||
return (
|
||||
<div className="grid grid-cols-3 grid-rows-3 gap-8 w-fit mx-auto">
|
||||
{Array.from({ length: 9 })
|
||||
.map(arrangeCards)
|
||||
.map((card, index) => (
|
||||
<div key={index} className="aspect-[2/3]}">
|
||||
{card && <Card card={card} cardIndex={cardMap[index]} />}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user