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.

12.3 KB
Raw Blame
{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "forme/lesson-plan",
  "title": "Lesson Plan",
  "description": "Lesson Plan PDF block (forme)",
  "dependencies": [
    "@formepdf/react",
    "@formepdf/core"
  ],
  "registryDependencies": [
    "@pdfcn/forme/utils",
    "@pdfcn/forme/page-footer",
    "@pdfcn/forme/page-header",
    "@pdfcn/forme/section",
    "@pdfcn/forme/table",
    "@pdfcn/forme/text"
  ],
  "files": [
    {
      "path": "registry/bases/forme/blocks/lesson-plan/lesson-plan.tsx",
      "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport { PageFooter } from \"@/components/pdf/page-footer/page-footer\";\nimport { PageHeader } from \"@/components/pdf/page-header/page-header\";\nimport { Section } from \"@/components/pdf/section/section\";\nimport {\n  Table,\n  TableBody,\n  TableCell,\n  TableHeader,\n  TableRow,\n} from \"@/components/pdf/table/table\";\nimport { Text } from \"@/components/pdf/text/text\";\nimport {\n  PdfcnThemeProvider,\n  usePdfcnTheme,\n} from \"@/components/pdf/theme-provider\";\nimport type { PdfcnTheme } from \"@/types/pdf-themes\";\n\nimport type { LessonPlanProps } from \"./lesson-plan.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: LessonPlanProps = {\n  accentColor: \"#7c3aed\",\n  assessment: {\n    formative: [\"Exit ticket\", \"Observation during guided practice\"],\n    summative: [\"Chapter quiz\"],\n  },\n  date: \"September 15, 2026\",\n  differentiation: [\n    \"Provide equation mats for visual learners\",\n    \"Allow calculator use for students with processing difficulties\",\n    \"Offer extension problems for advanced learners\",\n  ],\n  duration: \"50 minutes\",\n  essentialQuestion:\n    \"How can we represent real-world relationships using linear equations?\",\n  gradeLevel: \"8th Grade\",\n  homework: \"Complete worksheet problems 11-20\",\n  lessonTitle: \"Introduction to Linear Equations\",\n  materials: [\"Graph paper\", \"Rulers\", \"Calculator\", \"Whiteboard markers\"],\n  objectives: [\n    \"Define linear equations\",\n    \"Graph linear equations on a coordinate plane\",\n    \"Solve simple linear equations\",\n  ],\n  sequence: [\n    {\n      activity: \"Warm-up\",\n      description: \"Review solving one-step equations\",\n      notes: \"5 problems on the board\",\n      time: \"5 min\",\n    },\n    {\n      activity: \"Introduction\",\n      description: \"Define linear equations, show examples\",\n      notes: \"Use real-world context\",\n      time: \"10 min\",\n    },\n    {\n      activity: \"Guided Practice\",\n      description: \"Work through 3 examples together\",\n      notes: \"Check for understanding\",\n      time: \"15 min\",\n    },\n    {\n      activity: \"Independent Practice\",\n      description: \"Complete worksheet problems 1-10\",\n      notes: \"Circulate and support\",\n      time: \"15 min\",\n    },\n    {\n      activity: \"Closure\",\n      description: \"Exit ticket: solve one linear equation\",\n      notes: \"Collect before dismissal\",\n      time: \"5 min\",\n    },\n  ],\n  standards: [\"CCSS.MATH.8.EE.B.6\", \"CCSS.MATH.8.EE.C.7\"],\n  subject: \"Mathematics\",\n  teacherName: \"Ms. Johnson\",\n  topic: \"Linear Equations\",\n};\n\nconst REFLECTION_LINE_KEYS = Array.from(\n  { length: 8 },\n  (_, line) => `reflection-line-${line}`\n);\n\nconst COLUMN_WIDTHS = { activity: 104, notes: 140, time: 56 };\n\nconst LessonPlanContent = ({ data }: { data: LessonPlanProps }) => {\n  const theme = usePdfcnTheme();\n  const rule = {\n    borderBottomColor: theme.colors.border,\n    borderBottomStyle: \"solid\" as const,\n    borderBottomWidth: 1,\n  };\n\n  const styles = StyleSheet.create({\n    block: {\n      marginBottom: 16,\n    },\n    colHalf: {\n      flex: 2,\n      paddingRight: 20,\n    },\n    colQuarter: {\n      flex: 1,\n      paddingRight: 10,\n    },\n    infoRow: {\n      ...rule,\n      flexDirection: \"row\",\n      marginBottom: 16,\n      paddingBottom: 12,\n    },\n    intro: {\n      marginBottom: 3,\n    },\n    label: {\n      fontSize: 9,\n      fontWeight: \"bold\",\n      marginBottom: 4,\n    },\n    listMarker: {\n      width: 12,\n    },\n    listRow: {\n      flexDirection: \"row\",\n      marginBottom: 3,\n    },\n    listText: {\n      flex: 1,\n    },\n    page: {\n      backgroundColor: theme.colors.background,\n    },\n    reflectionLine: {\n      ...rule,\n      height: 24,\n    },\n    row: {\n      flexDirection: \"row\",\n    },\n  });\n\n  const pageMargin = {\n    bottom: theme.spacing.page.marginBottom,\n    left: theme.spacing.page.marginLeft,\n    right: theme.spacing.page.marginRight,\n    top: theme.spacing.page.marginTop,\n  };\n\n  const renderLabel = (label: string) => (\n    <Text\n      style={styles.label}\n      color=\"mutedForeground\"\n      transform=\"uppercase\"\n      noMargin\n    >\n      {label}\n    </Text>\n  );\n\n  const renderList = (items: string[] = [], numbered = false) =>\n    items.length > 0 ? (\n      items.map((item, index) => (\n        <View key={item} style={styles.listRow}>\n          <View style={styles.listMarker}>\n            <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n              {numbered ? `${index + 1}.` : \"•\"}\n            </Text>\n          </View>\n          <View style={styles.listText}>\n            <Text variant=\"xs\" noMargin>\n              {item}\n            </Text>\n          </View>\n        </View>\n      ))\n    ) : (\n      <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n        —\n      </Text>\n    );\n\n  const info = [\n    { label: \"Subject\", value: data.subject },\n    { label: \"Grade Level\", value: data.gradeLevel },\n    { label: \"Teacher\", value: data.teacherName },\n    { label: \"Duration\", value: data.duration },\n  ];\n\n  const footerText = `${data.subject} · ${data.gradeLevel} · ${data.lessonTitle}`;\n\n  return (\n    <Document title={`Lesson Plan — ${data.lessonTitle}`}>\n      <Page margin={pageMargin} size=\"A4\">\n        <PageFooter\n          leftText={footerText}\n          rightText=\"Page 1 of 2\"\n          sticky\n          pagePadding={25}\n        />\n        <View style={styles.page as never}>\n          <PageHeader\n            variant=\"simple\"\n            title={data.lessonTitle}\n            subtitle={\n              data.topic ? `Lesson Plan · ${data.topic}` : \"Lesson Plan\"\n            }\n            rightText={data.date}\n            marginBottom={16}\n          />\n\n          <View style={styles.infoRow}>\n            {info.map((item) => (\n              <View key={item.label} style={styles.colQuarter}>\n                {renderLabel(item.label)}\n                <Text variant=\"xs\" weight=\"medium\" noMargin>\n                  {item.value}\n                </Text>\n              </View>\n            ))}\n          </View>\n\n          {data.essentialQuestion ? (\n            <Section\n              variant=\"highlight\"\n              accentColor={data.accentColor}\n              spacing=\"none\"\n              padding=\"sm\"\n              style={styles.block}\n            >\n              {renderLabel(\"Essential Question\")}\n              <Text variant=\"sm\" weight=\"medium\" noMargin>\n                {data.essentialQuestion}\n              </Text>\n            </Section>\n          ) : null}\n\n          <View style={{ ...styles.row, ...styles.block }}>\n            <View style={styles.colHalf}>\n              {renderLabel(\"Objectives\")}\n              <Text\n                variant=\"xs\"\n                color=\"mutedForeground\"\n                style={styles.intro}\n                noMargin\n              >\n                Students will be able to (SWBAT):\n              </Text>\n              {renderList(data.objectives, true)}\n            </View>\n            {data.standards?.length ? (\n              <View style={styles.colQuarter}>\n                {renderLabel(\"Standards\")}\n                {renderList(data.standards)}\n              </View>\n            ) : null}\n            <View style={styles.colQuarter}>\n              {renderLabel(\"Materials\")}\n              {renderList(data.materials)}\n            </View>\n          </View>\n\n          <View>\n            {renderLabel(\"Lesson Sequence\")}\n            <Table variant=\"grid\" zebraStripe>\n              <TableHeader>\n                <TableRow header>\n                  <TableCell width={COLUMN_WIDTHS.time}>Time</TableCell>\n                  <TableCell width={COLUMN_WIDTHS.activity}>Activity</TableCell>\n                  <TableCell>Description</TableCell>\n                  <TableCell width={COLUMN_WIDTHS.notes}>Notes</TableCell>\n                </TableRow>\n              </TableHeader>\n              <TableBody>\n                {data.sequence.map((item) => (\n                  <TableRow key={`${item.time}-${item.activity}`}>\n                    <TableCell width={COLUMN_WIDTHS.time}>\n                      {item.time}\n                    </TableCell>\n                    <TableCell width={COLUMN_WIDTHS.activity}>\n                      {item.activity}\n                    </TableCell>\n                    <TableCell>{item.description}</TableCell>\n                    <TableCell width={COLUMN_WIDTHS.notes}>\n                      {item.notes ?? \"—\"}\n                    </TableCell>\n                  </TableRow>\n                ))}\n              </TableBody>\n            </Table>\n          </View>\n        </View>\n      </Page>\n\n      <Page margin={pageMargin} size=\"A4\">\n        <PageFooter\n          leftText={footerText}\n          rightText=\"Page 2 of 2\"\n          sticky\n          pagePadding={25}\n        />\n        <View style={styles.page as never}>\n          {data.differentiation?.length ? (\n            <View style={styles.block}>\n              {renderLabel(\"Differentiation\")}\n              {renderList(data.differentiation)}\n            </View>\n          ) : null}\n\n          <View style={{ ...styles.row, ...styles.block }}>\n            <View style={styles.colHalf}>\n              {renderLabel(\"Formative Assessment\")}\n              {renderList(data.assessment.formative)}\n            </View>\n            <View style={styles.colHalf}>\n              {renderLabel(\"Summative Assessment\")}\n              {renderList(data.assessment.summative)}\n            </View>\n          </View>\n\n          {data.homework ? (\n            <View style={styles.block}>\n              {renderLabel(\"Homework\")}\n              <Text variant=\"xs\" noMargin>\n                {data.homework}\n              </Text>\n            </View>\n          ) : null}\n\n          <View>\n            {renderLabel(\"Teacher Reflection\")}\n            {data.reflection ? (\n              <Text variant=\"xs\" noMargin>\n                {data.reflection}\n              </Text>\n            ) : null}\n            {REFLECTION_LINE_KEYS.map((key) => (\n              <View key={key} style={styles.reflectionLine} />\n            ))}\n          </View>\n        </View>\n      </Page>\n    </Document>\n  );\n};\n\nexport const LessonPlanDocument = ({\n  theme,\n  data,\n  ...props\n}: {\n  theme?: PdfcnTheme;\n  data?: LessonPlanProps;\n} & Partial<LessonPlanProps>) => (\n  <PdfcnThemeProvider theme={theme}>\n    <LessonPlanContent data={{ ...sampleData, ...data, ...props }} />\n  </PdfcnThemeProvider>\n);\n",
      "type": "registry:block",
      "target": "components/pdf/blocks/lesson-plan/lesson-plan.tsx"
    },
    {
      "path": "registry/bases/forme/blocks/lesson-plan/lesson-plan.types.ts",
      "content": "export interface LessonPlanSequenceItem {\n  time: string;\n  activity: string;\n  description: string;\n  notes?: string;\n}\n\nexport interface LessonPlanAssessment {\n  formative?: string[];\n  summative?: string[];\n}\n\nexport interface LessonPlanProps {\n  subject: string;\n  gradeLevel: string;\n  lessonTitle: string;\n  date: string;\n  teacherName: string;\n  duration: string;\n  topic?: string;\n  essentialQuestion?: string;\n  objectives: string[];\n  standards?: string[];\n  materials: string[];\n  sequence: LessonPlanSequenceItem[];\n  differentiation?: string[];\n  assessment: LessonPlanAssessment;\n  homework?: string;\n  reflection?: string;\n  accentColor?: string;\n  renderingBase?: \"takumi\" | \"forme\";\n}\n",
      "type": "registry:block",
      "target": "components/pdf/blocks/lesson-plan/lesson-plan.types.ts"
    }
  ],
  "type": "registry:block"
}