From efbc27a49976e5f2b826752e4523d09d5faa2476 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 3 Nov 2024 08:18:24 +0100 Subject: [PATCH] Render rounded tables --- app/ui/arrangements/arrangement.tsx | 2 +- app/ui/components/table.tsx | 64 +++++++++++++++++++++-------- 2 files changed, 49 insertions(+), 17 deletions(-) diff --git a/app/ui/arrangements/arrangement.tsx b/app/ui/arrangements/arrangement.tsx index f51baea..749c577 100644 --- a/app/ui/arrangements/arrangement.tsx +++ b/app/ui/arrangements/arrangement.tsx @@ -34,7 +34,7 @@ export default function Arrangement({ id }: { id: string }) {

Table distributions

{tables.map((table) => ( - +
))} diff --git a/app/ui/components/table.tsx b/app/ui/components/table.tsx index a042f4b..55a9c64 100644 --- a/app/ui/components/table.tsx +++ b/app/ui/components/table.tsx @@ -2,24 +2,25 @@ import { Guest } from "@/app/lib/definitions"; - -function GuestRow({ guests }: { guests: Guest[] }) { - return (
- { - guests.map((guest) => { - - return ( -
- {guest.name} -
- ) - }) - } - -
) +function Dish({ guest, rotation }: { guest: Guest, rotation?: number }) { + rotation = rotation || 0 + return ( +
+ {guest.name} +
+ ) } -export function Table({ guests }: { guests: Guest[] }) { + +function GuestRow({ guests }: { guests: Guest[] }) { + return ( +
+ {guests.map((guest) => )} +
+ ) +} + +function RectangularTable({ guests }: { guests: Guest[] }) { const halfwayThrough = Math.floor(guests.length / 2) const arrayFirstHalf = guests.slice(0, halfwayThrough); const arraySecondHalf = guests.slice(halfwayThrough, guests.length); @@ -30,4 +31,35 @@ export function Table({ guests }: { guests: Guest[] }) { ) +} + +function RoundedTable({ guests }: { guests: Guest[] }) { + const size = 500 + const rotation = 360 / guests.length + return ( +
+ { + guests.map((guest, index) => { + return ( +
+ +
+ ) + }) + } +
+ ) +} + +export function Table({ guests, style }: { guests: Guest[], style: "rectangular" | "rounded" }) { + return ( + <> + {style === "rectangular" && } + {style === "rounded" && } + + ) } \ No newline at end of file