diff --git a/app/components/draft/QueueSection.stories.tsx b/app/components/draft/QueueSection.stories.tsx new file mode 100644 index 0000000..3c77686 --- /dev/null +++ b/app/components/draft/QueueSection.stories.tsx @@ -0,0 +1,122 @@ +import type { Meta, StoryObj } from "@storybook/react-vite"; +import { QueueSection } from "./QueueSection"; + +const meta: Meta = { + title: "Draft/QueueSection", + component: QueueSection, + parameters: { + layout: "padded", + }, +}; + +export default meta; +type Story = StoryObj; + +const participants = [ + { id: "p1", name: "Max Verstappen", sport: { name: "F1" } }, + { id: "p2", name: "LeBron James", sport: { name: "Basketball" } }, + { id: "p3", name: "Scottie Scheffler", sport: { name: "Golf" } }, + { id: "p4", name: "Alexander Ovechkin-Washington", sport: { name: "Ice Hockey" } }, +]; + +const queue = [ + { id: "q1", participantId: "p1" }, + { id: "q2", participantId: "p2" }, + { id: "q3", participantId: "p3" }, +]; + +export const Empty: Story = { + args: { + queue: [], + availableParticipants: participants, + canPick: false, + onRemoveFromQueue: () => {}, + onReorder: () => {}, + onMakePick: () => {}, + }, +}; + +export const NotYourTurn: Story = { + name: "With Items — Not Your Turn", + args: { + queue, + availableParticipants: participants, + canPick: false, + onRemoveFromQueue: () => {}, + onReorder: () => {}, + onMakePick: () => {}, + }, +}; + +export const YourTurn: Story = { + name: "With Items — Your Turn (Draft button visible)", + args: { + queue, + availableParticipants: participants, + canPick: true, + onRemoveFromQueue: () => {}, + onReorder: () => {}, + onMakePick: () => {}, + }, +}; + +export const LongNameYourTurn: Story = { + name: "Long Name — Your Turn (two-line layout)", + args: { + queue: [{ id: "q1", participantId: "p4" }], + availableParticipants: participants, + canPick: true, + onRemoveFromQueue: () => {}, + onReorder: () => {}, + onMakePick: () => {}, + }, +}; + +export const LongNameNotYourTurn: Story = { + name: "Long Name — Not Your Turn (truncation only)", + args: { + queue: [{ id: "q1", participantId: "p4" }], + availableParticipants: participants, + canPick: false, + onRemoveFromQueue: () => {}, + onReorder: () => {}, + onMakePick: () => {}, + }, +}; + +export const SingleItem: Story = { + name: "Single Item — Your Turn", + args: { + queue: [{ id: "q1", participantId: "p1" }], + availableParticipants: participants, + canPick: true, + onRemoveFromQueue: () => {}, + onReorder: () => {}, + onMakePick: () => {}, + }, +}; + +const manyParticipants = [ + { id: "p1", name: "Max Verstappen", sport: { name: "F1" } }, + { id: "p2", name: "LeBron James", sport: { name: "Basketball" } }, + { id: "p3", name: "Scottie Scheffler", sport: { name: "Golf" } }, + { id: "p4", name: "Alexander Ovechkin-Washington", sport: { name: "Ice Hockey" } }, + { id: "p5", name: "Patrick Mahomes", sport: { name: "NFL" } }, + { id: "p6", name: "Connor McDavid", sport: { name: "Ice Hockey" } }, + { id: "p7", name: "Novak Djokovic", sport: { name: "Tennis" } }, + { id: "p8", name: "Erling Haaland", sport: { name: "Soccer" } }, +]; + +const longQueue = manyParticipants.map((p, i) => ({ id: `q${i + 1}`, participantId: p.id })); + +export const FullQueue: Story = { + name: "Full Queue — Your Turn (scroll check)", + args: { + queue: longQueue, + availableParticipants: manyParticipants, + canPick: true, + onRemoveFromQueue: () => {}, + onReorder: () => {}, + onMakePick: () => {}, + }, +}; diff --git a/app/components/draft/QueueSection.tsx b/app/components/draft/QueueSection.tsx index c668fe0..8fab258 100644 --- a/app/components/draft/QueueSection.tsx +++ b/app/components/draft/QueueSection.tsx @@ -75,45 +75,45 @@ const SortableQueueItem = memo(function SortableQueueItem({ ref={setNodeRef} style={style} {...attributes} - className={`flex items-center justify-between p-2 rounded-lg ${ + className={`p-2 rounded-lg ${ canPick ? "bg-electric/10 border border-electric/40" : "bg-muted" }`} > -
+
{index + 1}
-
+

{participantName}

{sportName &&

{sportName}

}
-
-
- {canPick && onDraft && ( - - )}
+ {canPick && onDraft && ( +
+ +
+ )}
); });