Skip to content

armgit / pdfcn

Public Imported from GitHub
0

Beautiful pdf components, built on Takumi and Forme. 100% Free, Zero config, one command setup.

27.5 KB
Raw Blame
{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "takumi/event-agenda",
  "title": "Event Agenda",
  "description": "Event Agenda PDF block (takumi)",
  "dependencies": [
    "takumi-pdf",
    "@takumi-rs/helpers"
  ],
  "registryDependencies": [
    "@pdfcn/takumi/utils",
    "@pdfcn/takumi/badge",
    "@pdfcn/takumi/page-footer",
    "@pdfcn/takumi/section",
    "@pdfcn/takumi/text"
  ],
  "files": [
    {
      "path": "registry/bases/takumi/blocks/event-agenda/event-agenda.tsx",
      "content": "import { Section } from \"@/components/pdf/section/section\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n  PdfcnThemeProvider,\n  usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport {\n  Document,\n  Page,\n  StyleSheet,\n  View,\n} from \"@/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { EventAgendaProps, Session } from \"./event-agenda.types\";\nimport { sampleEventAgendaData } from \"./event-agenda.types\";\n\ninterface TimeSlotGroup {\n  sessions: Session[];\n  time: string;\n}\n\nconst groupSessionsByTime = (sessions: Session[]): TimeSlotGroup[] => {\n  const groups: TimeSlotGroup[] = [];\n  const map = new Map<string, Session[]>();\n\n  for (const session of sessions) {\n    const existing = map.get(session.time);\n    if (existing) {\n      existing.push(session);\n    } else {\n      const list = [session];\n      map.set(session.time, list);\n      groups.push({ sessions: list, time: session.time });\n    }\n  }\n\n  return groups;\n};\n\nexport const EventAgendaContent = ({ data }: { data: EventAgendaProps }) => {\n  const theme = usePdfcnTheme();\n  const accent = data.accentColor ?? theme.colors.primary;\n\n  const trackColorMap = new Map<string, string>();\n  if (data.tracks) {\n    for (const track of data.tracks) {\n      trackColorMap.set(track.name.toLowerCase(), track.color);\n    }\n  }\n\n  const styles = StyleSheet.create({\n    breakBadge: {\n      backgroundColor: theme.colors.muted,\n      borderColor: theme.colors.border,\n      borderRadius: 4,\n      borderStyle: \"solid\",\n      borderWidth: 1,\n      paddingHorizontal: 6,\n      paddingVertical: 2,\n    },\n    breakCard: {\n      backgroundColor: theme.colors.muted,\n      borderColor: theme.colors.border,\n      borderRadius: 6,\n      borderStyle: \"dashed\",\n      borderWidth: 1,\n      flex: 1,\n      paddingHorizontal: 10,\n      paddingVertical: 7,\n    },\n    dayBanner: {\n      alignItems: \"center\",\n      backgroundColor: theme.colors.muted,\n      borderColor: theme.colors.border,\n      borderRadius: 6,\n      borderStyle: \"solid\",\n      borderWidth: 1,\n      flexDirection: \"row\",\n      justifyContent: \"space-between\",\n      marginBottom: 10,\n      marginTop: 8,\n      paddingHorizontal: 12,\n      paddingVertical: 6,\n    },\n    footerContainer: {\n      borderTopColor: theme.colors.border,\n      borderTopStyle: \"solid\",\n      borderTopWidth: 1,\n      flexDirection: \"row\",\n      justifyContent: \"space-between\",\n      marginTop: \"auto\",\n      paddingTop: 8,\n    },\n    headerContainer: {\n      borderBottomColor: theme.colors.border,\n      borderBottomStyle: \"solid\",\n      borderBottomWidth: 1.5,\n      flexDirection: \"row\",\n      justifyContent: \"space-between\",\n      paddingBottom: 10,\n    },\n    legendContainer: {\n      alignItems: \"center\",\n      flexDirection: \"row\",\n      flexWrap: \"wrap\",\n      gap: 6,\n      marginBottom: 8,\n    },\n    legendDot: {\n      borderRadius: 3,\n      height: 7,\n      marginRight: 4,\n      width: 7,\n    },\n    legendItem: {\n      alignItems: \"center\",\n      backgroundColor: theme.colors.muted,\n      borderColor: theme.colors.border,\n      borderRadius: 4,\n      borderStyle: \"solid\",\n      borderWidth: 1,\n      flexDirection: \"row\",\n      paddingHorizontal: 6,\n      paddingVertical: 2,\n    },\n    page: {\n      backgroundColor: theme.colors.background,\n      boxSizing: \"border-box\",\n      minHeight: 841,\n      padding: 32,\n      position: \"relative\",\n    },\n    roomBadge: {\n      backgroundColor: theme.colors.muted,\n      borderColor: theme.colors.border,\n      borderRadius: 3,\n      borderStyle: \"solid\",\n      borderWidth: 1,\n      paddingHorizontal: 5,\n      paddingVertical: 1,\n    },\n    sessionCard: {\n      backgroundColor: theme.colors.background,\n      borderColor: theme.colors.border,\n      borderRadius: 6,\n      borderStyle: \"solid\",\n      borderWidth: 1,\n      flex: 1,\n      flexDirection: \"column\",\n      paddingHorizontal: 10,\n      paddingVertical: 7,\n      position: \"relative\",\n    },\n    sessionsRow: {\n      flex: 1,\n      flexDirection: \"row\",\n      gap: 8,\n    },\n    timeBox: {\n      alignItems: \"flex-start\",\n      flexDirection: \"column\",\n      paddingTop: 2,\n      width: 78,\n    },\n    timeSlotRow: {\n      flexDirection: \"row\",\n      marginBottom: 8,\n    },\n    trackBadge: {\n      borderRadius: 3,\n      paddingHorizontal: 6,\n      paddingVertical: 1,\n    },\n  });\n\n  return (\n    <Document title={`${data.eventName} - Agenda`}>\n      {data.days.map((day, dayIndex) => {\n        const timeSlots = groupSessionsByTime(day.sessions);\n\n        return (\n          <Page key={day.label} size=\"A4\" style={styles.page}>\n            {/* Header */}\n            <View style={styles.headerContainer}>\n              <View style={{ flex: 1, paddingRight: 16 }}>\n                <Text\n                  style={{\n                    color: accent,\n                    fontSize: 8.5,\n                    fontWeight: \"bold\",\n                    letterSpacing: 1.2,\n                    marginBottom: 2,\n                    textTransform: \"uppercase\",\n                  }}\n                  noMargin\n                >\n                  Event Agenda\n                </Text>\n                <Text\n                  style={{\n                    fontSize: 20,\n                    fontWeight: \"bold\",\n                    lineHeight: 1.2,\n                    marginBottom: 4,\n                  }}\n                  noMargin\n                >\n                  {data.eventName}\n                </Text>\n                <Text\n                  style={{ color: theme.colors.mutedForeground, fontSize: 8.5 }}\n                  noMargin\n                >\n                  {data.date}\n                  {data.endDate ? ` – ${data.endDate}` : \"\"} • {data.venue}\n                </Text>\n              </View>\n\n              <View\n                style={{ alignItems: \"flex-end\", justifyContent: \"center\" }}\n              >\n                <View\n                  style={{\n                    backgroundColor: accent,\n                    borderRadius: 4,\n                    paddingHorizontal: 10,\n                    paddingVertical: 4,\n                  }}\n                >\n                  <Text\n                    style={{\n                      color: \"#ffffff\",\n                      fontSize: 10,\n                      fontWeight: \"bold\",\n                      letterSpacing: 0.8,\n                      textTransform: \"uppercase\",\n                    }}\n                    noMargin\n                  >\n                    AGENDA\n                  </Text>\n                </View>\n              </View>\n            </View>\n\n            {/* Day Title Banner */}\n            <View style={styles.dayBanner}>\n              <View\n                style={{ alignItems: \"center\", flexDirection: \"row\", gap: 6 }}\n              >\n                <Text style={{ fontSize: 11, fontWeight: \"bold\" }} noMargin>\n                  {day.label}\n                </Text>\n                <Text\n                  style={{ color: theme.colors.mutedForeground, fontSize: 9 }}\n                  noMargin\n                >\n                  — {day.date}\n                </Text>\n              </View>\n\n              <Text\n                style={{\n                  color: theme.colors.mutedForeground,\n                  fontSize: 8.5,\n                  fontWeight: 600,\n                }}\n                noMargin\n              >\n                Day {dayIndex + 1} of {data.days.length}\n              </Text>\n            </View>\n\n            {/* Track Legend (if available) */}\n            {data.tracks && data.tracks.length > 0 && (\n              <View style={styles.legendContainer}>\n                <Text\n                  style={{\n                    color: theme.colors.mutedForeground,\n                    fontSize: 7.5,\n                    fontWeight: \"bold\",\n                    letterSpacing: 0.5,\n                    marginRight: 4,\n                    textTransform: \"uppercase\",\n                  }}\n                  noMargin\n                >\n                  Tracks:\n                </Text>\n                {data.tracks.map((track) => (\n                  <View key={track.name} style={styles.legendItem}>\n                    <View\n                      style={[\n                        styles.legendDot,\n                        { backgroundColor: track.color },\n                      ]}\n                    />\n                    <Text style={{ fontSize: 7.5, fontWeight: 600 }} noMargin>\n                      {track.name}\n                    </Text>\n                  </View>\n                ))}\n              </View>\n            )}\n\n            {/* Sessions Time Grid */}\n            <Section style={{ marginTop: 2 }}>\n              {timeSlots.map((slot) => {\n                const isSingleBreak =\n                  slot.sessions.length === 1 && slot.sessions[0].isBreak;\n\n                return (\n                  <View key={slot.time} style={styles.timeSlotRow}>\n                    {/* Time Column */}\n                    <View style={styles.timeBox}>\n                      <Text\n                        style={{\n                          color: theme.colors.foreground,\n                          fontSize: 9,\n                          fontWeight: \"bold\",\n                        }}\n                        noMargin\n                      >\n                        {slot.time}\n                      </Text>\n                      {slot.sessions[0].endTime && (\n                        <Text\n                          style={{\n                            color: theme.colors.mutedForeground,\n                            fontSize: 7.5,\n                          }}\n                          noMargin\n                        >\n                          to {slot.sessions[0].endTime}\n                        </Text>\n                      )}\n                    </View>\n\n                    {/* Content Column */}\n                    {isSingleBreak ? (\n                      <View style={styles.breakCard}>\n                        <View\n                          style={{\n                            alignItems: \"center\",\n                            flexDirection: \"row\",\n                            justifyContent: \"space-between\",\n                          }}\n                        >\n                          <Text\n                            style={{\n                              color: theme.colors.foreground,\n                              fontSize: 9.5,\n                              fontWeight: \"bold\",\n                            }}\n                            noMargin\n                          >\n                            {slot.sessions[0].title}\n                          </Text>\n                          <View style={styles.breakBadge}>\n                            <Text\n                              style={{\n                                color: theme.colors.mutedForeground,\n                                fontSize: 7,\n                                fontWeight: \"bold\",\n                                letterSpacing: 0.5,\n                                textTransform: \"uppercase\",\n                              }}\n                              noMargin\n                            >\n                              Break\n                            </Text>\n                          </View>\n                        </View>\n                        {slot.sessions[0].description && (\n                          <Text\n                            style={{\n                              color: theme.colors.mutedForeground,\n                              fontSize: 7.5,\n                              marginTop: 2,\n                            }}\n                            noMargin\n                          >\n                            {slot.sessions[0].description}\n                          </Text>\n                        )}\n                      </View>\n                    ) : (\n                      <View style={styles.sessionsRow}>\n                        {slot.sessions.map((session, sIndex) => {\n                          const trackColor = session.track\n                            ? trackColorMap.get(session.track.toLowerCase())\n                            : undefined;\n\n                          return (\n                            <View\n                              key={`${session.title}-${sIndex}`}\n                              style={[\n                                styles.sessionCard,\n                                trackColor\n                                  ? {\n                                      borderLeftColor: trackColor,\n                                      borderLeftWidth: 3,\n                                    }\n                                  : {},\n                              ]}\n                            >\n                              {/* Track & Room Metadata */}\n                              <View\n                                style={{\n                                  alignItems: \"center\",\n                                  flexDirection: \"row\",\n                                  gap: 4,\n                                  marginBottom: 3,\n                                }}\n                              >\n                                {session.track && (\n                                  <View\n                                    style={[\n                                      styles.trackBadge,\n                                      {\n                                        backgroundColor: trackColor\n                                          ? `${trackColor}1A`\n                                          : theme.colors.muted,\n                                      },\n                                    ]}\n                                  >\n                                    <Text\n                                      style={{\n                                        color:\n                                          trackColor ?? theme.colors.foreground,\n                                        fontSize: 7,\n                                        fontWeight: \"bold\",\n                                      }}\n                                      noMargin\n                                    >\n                                      {session.track}\n                                    </Text>\n                                  </View>\n                                )}\n                                {session.room && (\n                                  <View style={styles.roomBadge}>\n                                    <Text\n                                      style={{\n                                        color: theme.colors.mutedForeground,\n                                        fontSize: 7,\n                                        fontWeight: 600,\n                                      }}\n                                      noMargin\n                                    >\n                                      {session.room}\n                                    </Text>\n                                  </View>\n                                )}\n                              </View>\n\n                              {/* Title */}\n                              <Text\n                                style={{\n                                  fontSize: 9,\n                                  fontWeight: \"bold\",\n                                  lineHeight: 1.25,\n                                }}\n                                noMargin\n                              >\n                                {session.title}\n                              </Text>\n\n                              {/* Speaker */}\n                              {session.speaker && (\n                                <Text\n                                  style={{\n                                    color: accent,\n                                    fontSize: 7.8,\n                                    fontWeight: 600,\n                                    marginTop: 2,\n                                  }}\n                                  noMargin\n                                >\n                                  {session.speaker}\n                                </Text>\n                              )}\n\n                              {/* Description */}\n                              {session.description && (\n                                <Text\n                                  style={{\n                                    color: theme.colors.mutedForeground,\n                                    fontSize: 7.2,\n                                    lineHeight: 1.2,\n                                    marginTop: 2,\n                                  }}\n                                  noMargin\n                                >\n                                  {session.description}\n                                </Text>\n                              )}\n                            </View>\n                          );\n                        })}\n                      </View>\n                    )}\n                  </View>\n                );\n              })}\n            </Section>\n\n            {/* Footer */}\n            <View style={styles.footerContainer}>\n              <View style={{ flexDirection: \"column\", gap: 1 }}>\n                {data.wifiInfo && (\n                  <Text\n                    style={{\n                      color: theme.colors.mutedForeground,\n                      fontSize: 7.5,\n                      fontWeight: 600,\n                    }}\n                    noMargin\n                  >\n                    Wi-Fi: {data.wifiInfo}\n                  </Text>\n                )}\n                {data.emergencyContact && (\n                  <Text\n                    style={{\n                      color: theme.colors.mutedForeground,\n                      fontSize: 7.2,\n                    }}\n                    noMargin\n                  >\n                    {data.emergencyContact}\n                  </Text>\n                )}\n              </View>\n\n              <View style={{ alignItems: \"flex-end\" }}>\n                <Text\n                  style={{\n                    color: theme.colors.mutedForeground,\n                    fontSize: 7.5,\n                    fontWeight: 600,\n                  }}\n                  noMargin\n                >\n                  Page {dayIndex + 1} of {data.days.length}\n                </Text>\n              </View>\n            </View>\n          </Page>\n        );\n      })}\n    </Document>\n  );\n};\n\nexport const EventAgendaDocument = ({\n  theme,\n  data = sampleEventAgendaData,\n}: {\n  theme?: PdfcnTheme;\n  data?: EventAgendaProps;\n}) => (\n  <PdfcnThemeProvider theme={theme}>\n    <EventAgendaContent data={data} />\n  </PdfcnThemeProvider>\n);\n\nexport { EventAgendaDocument as EventAgenda };\n",
      "type": "registry:block",
      "target": "components/pdf/blocks/event-agenda/event-agenda.tsx"
    },
    {
      "path": "registry/bases/takumi/blocks/event-agenda/event-agenda.types.ts",
      "content": "export interface Session {\n  description?: string;\n  endTime?: string;\n  isBreak?: boolean;\n  room?: string;\n  speaker?: string;\n  time: string;\n  title: string;\n  track?: string;\n}\n\nexport interface DaySchedule {\n  date: string;\n  label: string;\n  sessions: Session[];\n}\n\nexport interface Track {\n  color: string;\n  name: string;\n}\n\nexport interface EventAgendaProps {\n  accentColor?: string;\n  date: string;\n  days: DaySchedule[];\n  emergencyContact?: string;\n  endDate?: string;\n  eventName: string;\n  renderingBase?: \"takumi\" | \"forme\";\n  tracks?: Track[];\n  venue: string;\n  wifiInfo?: string;\n}\n\nexport const sampleEventAgendaData: EventAgendaProps = {\n  accentColor: \"#dc2626\",\n  date: \"October 20, 2026\",\n  days: [\n    {\n      date: \"October 20, 2026\",\n      label: \"Day 1\",\n      sessions: [\n        {\n          description:\n            \"Check-in, grab your badge, and enjoy breakfast with peers.\",\n          endTime: \"9:00 AM\",\n          isBreak: true,\n          time: \"8:00 AM\",\n          title: \"Registration & Breakfast\",\n        },\n        {\n          description:\n            \"An overview of recent evolutions and the road ahead for UI engineering.\",\n          endTime: \"9:45 AM\",\n          room: \"Main Hall\",\n          speaker: \"Dan Abramov\",\n          time: \"9:00 AM\",\n          title: \"Opening Keynote: The Next Decade of React\",\n          track: \"Core React\",\n        },\n        {\n          description:\n            \"Real-world architecture patterns, streaming benefits, and edge-case handling.\",\n          endTime: \"10:45 AM\",\n          room: \"Room A\",\n          speaker: \"Sarah Chen\",\n          time: \"10:00 AM\",\n          title: \"Server Components in Production\",\n          track: \"Core React\",\n        },\n        {\n          description:\n            \"Navigating signals, atomic state, and server state synchronization.\",\n          endTime: \"10:45 AM\",\n          room: \"Room B\",\n          speaker: \"Mark Erikson\",\n          time: \"10:00 AM\",\n          title: \"State Management in 2026\",\n          track: \"Ecosystem\",\n        },\n        {\n          description: \"Exhibition hall coffee stations open.\",\n          endTime: \"11:30 AM\",\n          isBreak: true,\n          time: \"11:00 AM\",\n          title: \"Coffee & Networking Break\",\n        },\n        {\n          description:\n            \"Ensuring WCAG AAA compliance with composable headless components.\",\n          endTime: \"12:15 PM\",\n          room: \"Room A\",\n          speaker: \"Rachel Andrew\",\n          time: \"11:30 AM\",\n          title: \"Building Accessible Design Systems\",\n          track: \"Core React\",\n        },\n        {\n          description:\n            \"How automatic memoization transforms rendering pipelines.\",\n          endTime: \"12:15 PM\",\n          room: \"Room B\",\n          speaker: \"Andrew Clark\",\n          time: \"11:30 AM\",\n          title: \"Compiler Deep Dive: Under the Hood\",\n          track: \"Ecosystem\",\n        },\n        {\n          description: \"Lunch served in the Grand Ballroom.\",\n          endTime: \"1:45 PM\",\n          isBreak: true,\n          time: \"12:30 PM\",\n          title: \"Catered Lunch & Sponsor Showcase\",\n        },\n        {\n          description:\n            \"Hands-on exercises exploring Actions, optimistic updates, and new hooks.\",\n          endTime: \"3:30 PM\",\n          room: \"Workshop Lab\",\n          speaker: \"Ken Wheeler\",\n          time: \"2:00 PM\",\n          title: \"Interactive Workshop: Building with React 19\",\n          track: \"Workshop\",\n        },\n        {\n          description:\n            \"Module federation techniques across distributed product teams.\",\n          endTime: \"3:00 PM\",\n          room: \"Room A\",\n          speaker: \"Zack Jackson\",\n          time: \"2:00 PM\",\n          title: \"Micro-Frontends at Scale\",\n          track: \"Ecosystem\",\n        },\n        {\n          endTime: \"4:00 PM\",\n          isBreak: true,\n          time: \"3:30 PM\",\n          title: \"Afternoon Refreshments\",\n        },\n        {\n          description:\n            \"Reflections on Day 1 highlights, open mic session, and evening preview.\",\n          endTime: \"5:00 PM\",\n          room: \"Main Hall\",\n          speaker: \"Sophie Alpert\",\n          time: \"4:00 PM\",\n          title: \"Closing Keynote & Community Q&A\",\n          track: \"Core React\",\n        },\n      ],\n    },\n    {\n      date: \"October 21, 2026\",\n      label: \"Day 2\",\n      sessions: [\n        {\n          description: \"Morning refreshments in the networking lounge.\",\n          endTime: \"9:30 AM\",\n          isBreak: true,\n          time: \"8:30 AM\",\n          title: \"Welcome Coffee & Light Breakfast\",\n        },\n        {\n          description:\n            \"How generative agents and generative UI are shaping application architectures.\",\n          endTime: \"10:30 AM\",\n          room: \"Main Hall\",\n          speaker: \"Seb Markbåge\",\n          time: \"9:30 AM\",\n          title: \"Future of React & AI Agent Integrations\",\n          track: \"Core React\",\n        },\n        {\n          description:\n            \"Actionable metrics, Core Web Vitals, and avoiding main-thread bottlenecks.\",\n          endTime: \"11:45 AM\",\n          room: \"Room A\",\n          speaker: \"Addy Osmani\",\n          time: \"10:45 AM\",\n          title: \"Performance Profiling for Modern Web Apps\",\n          track: \"Core React\",\n        },\n        {\n          description:\n            \"Sync engines, conflict resolution, and ultra-fast client-side queries.\",\n          endTime: \"11:45 AM\",\n          room: \"Room B\",\n          speaker: \"Tanner Linsley\",\n          time: \"10:45 AM\",\n          title: \"Offline-First Architecture with Local-First Databases\",\n          track: \"Ecosystem\",\n        },\n        {\n          description:\n            \"Quick 5-minute community-submitted presentations in the theater.\",\n          endTime: \"1:15 PM\",\n          isBreak: true,\n          time: \"12:00 PM\",\n          title: \"Lunch & Community Lightning Talks\",\n        },\n        {\n          description:\n            \"Profiling real-world codebases, memory leak identification, and bundle size reduction.\",\n          endTime: \"3:00 PM\",\n          room: \"Workshop Lab\",\n          speaker: \"Lydia Hallie\",\n          time: \"1:30 PM\",\n          title: \"Hands-on Performance Optimization Workshop\",\n          track: \"Workshop\",\n        },\n        {\n          description:\n            \"Vite, Turbopack, Biome, Oxfmt, and next-generation dev speed.\",\n          endTime: \"4:15 PM\",\n          room: \"Main Hall\",\n          speaker: \"Industry Panelists\",\n          time: \"3:15 PM\",\n          title: \"Panel Discussion: What's Next for Developer Tooling\",\n          track: \"Ecosystem\",\n        },\n        {\n          description: \"Drinks and appetizers at the convention terrace.\",\n          endTime: \"6:00 PM\",\n          isBreak: true,\n          time: \"4:30 PM\",\n          title: \"Closing Reception & Networking Afterparty\",\n        },\n      ],\n    },\n  ],\n  emergencyContact:\n    \"Organizers Desk: +31 20 123 4567 | [email protected]\",\n  endDate: \"October 21, 2026\",\n  eventName: \"React Summit 2026\",\n  tracks: [\n    { color: \"#3b82f6\", name: \"Core React\" },\n    { color: \"#10b981\", name: \"Ecosystem\" },\n    { color: \"#f59e0b\", name: \"Workshop\" },\n  ],\n  venue: \"Amsterdam Convention Center\",\n  wifiInfo: \"Network: ReactSummit / Password: react2026\",\n};\n",
      "type": "registry:block",
      "target": "components/pdf/blocks/event-agenda/event-agenda.types.ts"
    }
  ],
  "type": "registry:block"
}