brackt/app/components/sport-season/UpcomingEventsCard.stories.tsx
Chris Parsons e0cd829b9f Redesign home page with new layout and component system
- Two-column layout (My Leagues 2/3, Upcoming Events 1/3) with mobile stack
- LeagueRow: square avatar, gradient draft highlight, rank/points display, progress bar
- MyLeaguesCard, CreateLeagueCard with shared SectionCardHeader
- UpcomingEventsCard: vertical timeline with grouped multi-league events
- Shared gradient system: BracktGradients SVG defs, GradientIcon wrapper, brand.ts constants
- Button default variant updated to green→cyan gradient
- Navbar: plain nav links with gradient hover, support/admin icon buttons
- Accessibility fixes: semantic h2 headings, aria-label on LeagueAvatar and nav elements
- Storybook stories for all new components

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 19:50:39 -07:00

136 lines
3.4 KiB
TypeScript

import type { Meta, StoryObj } from "@storybook/react-vite";
import { EventRow } from "./UpcomingEventsCard";
import type { GroupedEvent } from "./UpcomingEventsCard";
// ─── Shared fixtures ──────────────────────────────────────────────────────────
const tomorrowISO = "2026-04-15T17:00:00.000Z";
const nextWeekStr = "2026-04-22";
const singleLeague = {
leagueId: "league-abc-123",
leagueName: "Alpha Dynasty",
};
const otherLeague = {
leagueId: "league-xyz-999",
leagueName: "Hardcourt Elites",
};
// ─── EventRow ─────────────────────────────────────────────────────────────────
const eventRowMeta: Meta<typeof EventRow> = {
title: "Sport Season/EventRow",
component: EventRow,
parameters: { layout: "padded" },
};
export default eventRowMeta;
type EventRowStory = StoryObj<typeof EventRow>;
const baseEvent: GroupedEvent = {
id: "event-1",
name: "NBA Playoffs Game 3",
matchLabel: "Lakers vs Celtics",
eventDate: null,
earliestGameTime: tomorrowISO,
eventType: "playoff_game",
sportName: "NBA",
sportSeasonName: "2025 NBA Season",
sportsSeasonPageUrl: "/leagues/league-abc-123/sports-seasons/ss-nba-1",
isAllCompete: false,
totalParticipants: 2,
leagues: [
{
...singleLeague,
participants: [
{ id: "p1", name: "LeBron James" },
{ id: "p2", name: "Jayson Tatum" },
],
},
],
};
export const FirstEvent: EventRowStory = {
args: { event: baseEvent, isFirst: true, isLast: false },
};
export const MiddleEvent: EventRowStory = {
args: {
event: {
...baseEvent,
id: "event-2",
name: "F1 Monaco Grand Prix",
matchLabel: null,
earliestGameTime: null,
eventDate: nextWeekStr,
eventType: "race",
sportName: "F1",
isAllCompete: true,
totalParticipants: 4,
leagues: [
{
...singleLeague,
participants: [
{ id: "p3", name: "Max Verstappen" },
{ id: "p4", name: "Charles Leclerc" },
{ id: "p5", name: "Fernando Alonso" },
{ id: "p6", name: "Lewis Hamilton" },
],
},
],
},
isFirst: false,
isLast: false,
},
};
export const LastEvent: EventRowStory = {
args: {
event: { ...baseEvent, id: "event-last", name: "Snooker World Final", matchLabel: "Round of 16" },
isFirst: false,
isLast: true,
},
};
export const MultiLeague: EventRowStory = {
args: {
event: {
...baseEvent,
id: "event-multi",
name: "Champions League Quarter-Final",
matchLabel: "Man City vs Real Madrid",
sportName: "UCL",
leagues: [
{
...singleLeague,
participants: [{ id: "p10", name: "Erling Haaland" }],
},
{
...otherLeague,
participants: [{ id: "p11", name: "Vinicius Jr" }],
},
],
},
isFirst: true,
isLast: true,
},
};
export const NoLink: EventRowStory = {
args: {
event: { ...baseEvent, sportsSeasonPageUrl: undefined },
isFirst: true,
isLast: true,
},
};
export const TBDDate: EventRowStory = {
args: {
event: { ...baseEvent, earliestGameTime: null, eventDate: null },
isFirst: false,
isLast: true,
},
};