Beautiful pdf components, built on Takumi and Forme. 100% Free, Zero config, one command setup.
feat(registry): add lesson plan block for forme
Marcos Paulo Dinizfcaa4521968a
diff --git a/apps/web/registry/bases/forme/blocks/lesson-plan/lesson-plan.tsx b/apps/web/registry/bases/forme/blocks/lesson-plan/lesson-plan.tsxnew file mode 100644index 0000000..d9c7339--- /dev/null+++ b/apps/web/registry/bases/forme/blocks/lesson-plan/lesson-plan.tsx@@ -0,0 +1,407 @@+import { Document, Page, StyleSheet, View } from "@formepdf/react";++import { PdfList } from "@/registry/bases/forme/components/list/list";+import { PageFooter } from "@/registry/bases/forme/components/page-footer/page-footer";+import { PageHeader } from "@/registry/bases/forme/components/page-header/page-header";+import { Section } from "@/registry/bases/forme/components/section/section";+import {+ Table,+ TableBody,+ TableCell,+ TableHeader,+ TableRow,+} from "@/registry/bases/forme/components/table/table";+import { Text } from "@/registry/bases/forme/components/text/text";+import {+ PdfcnThemeProvider,+ usePdfcnTheme,+} from "@/registry/bases/forme/components/theme-provider";+import type { PdfcnTheme } from "@/registry/types/pdf-themes";++import type { LessonPlanData } from "./lesson-plan.types";++// Sample data — replace with your own props or data source+const sampleData: LessonPlanData = {+ accentColor: "#7c3aed",+ assessment: {+ formative: ["Exit ticket", "Observation", "Guided practice responses"],+ summative: ["Chapter quiz", "Unit assessment"],+ },+ date: "September 15, 2026",+ differentiation: [+ "Provide equation mats for visual learners",+ "Allow calculator use for students with processing difficulties",+ "Offer extension problems for advanced learners",+ ],+ duration: "50 minutes",+ essentialQuestion:+ "How can we represent real-world relationships using linear equations?",+ gradeLevel: "8th Grade",+ homework: "Complete worksheet problems 11-20",+ lessonTitle: "Introduction to Linear Equations",+ materials: ["Graph paper", "Rulers", "Calculator", "Whiteboard markers"],+ objectives: [+ "Define linear equations",+ "Graph linear equations on a coordinate plane",+ "Solve simple linear equations",+ ],+ reflection:+ "Note student misconceptions during independent practice and adjust the warm-up for the next lesson.",+ sequence: [+ {+ activity: "Warm-up",+ description: "Review solving one-step equations",+ notes: "5 problems on the board",+ time: "5 min",+ },+ {+ activity: "Introduction",+ description: "Define linear equations, show examples",+ notes: "Use real-world context",+ time: "10 min",+ },+ {+ activity: "Guided Practice",+ description: "Work through 3 examples together",+ notes: "Check for understanding",+ time: "15 min",+ },+ {+ activity: "Independent Practice",+ description: "Complete worksheet problems 1-10",+ notes: "Circulate and support",+ time: "15 min",+ },+ {+ activity: "Closure",+ description: "Exit ticket: solve one linear equation",+ notes: "Collect before dismissal",+ time: "5 min",+ },+ ],+ standards: ["CCSS.MATH.8.EE.B.6", "CCSS.MATH.8.EE.C.7"],+ subject: "Mathematics",+ teacherName: "Ms. Johnson",+ topic: "Linear Equations",+};++const LessonPlanContent = ({ data }: { data: LessonPlanData }) => {+ const theme = usePdfcnTheme();++ const styles = StyleSheet.create({+ col: {+ flex: 1,+ paddingRight: 10,+ },+ label: {+ fontSize: 9,+ fontWeight: "bold",+ marginBottom: 2,+ },+ page: {+ backgroundColor: theme.colors.background,+ },+ row: {+ flexDirection: "row",+ },+ section: {+ marginBottom: theme.spacing.componentGap,+ },+ });++ return (+ <Document title={`${data.lessonTitle} — Lesson Plan`}>+ <Page+ margin={{+ bottom: theme.spacing.page.marginBottom,+ left: theme.spacing.page.marginLeft,+ right: theme.spacing.page.marginRight,+ top: theme.spacing.page.marginTop,+ }}+ size="A4"+ >+ <PageFooter+ leftText={`${data.subject} — ${data.lessonTitle}`}+ rightText="Page 1 of 2"+ sticky+ pagePadding={25}+ />+ <View style={styles.page as never}>+ <PageHeader+ title={data.lessonTitle}+ subtitle={`${data.subject} \u2022 ${data.gradeLevel}`}+ rightText={`Teacher: ${data.teacherName}`}+ rightSubText={`Date: ${data.date}`}+ style={styles.section}+ />++ <Section+ noWrap+ spacing="none"+ style={{ ...styles.row, ...styles.section }}+ >+ <View style={styles.col}>+ <Text+ style={styles.label}+ color="mutedForeground"+ transform="uppercase"+ noMargin+ >+ Duration+ </Text>+ <Text noMargin variant="xs">+ {data.duration}+ </Text>+ </View>+ <View style={styles.col}>+ <Text+ style={styles.label}+ color="mutedForeground"+ transform="uppercase"+ noMargin+ >+ Topic+ </Text>+ <Text noMargin variant="xs">+ {data.topic}+ </Text>+ </View>+ {data.essentialQuestion ? (+ <View style={{ flex: 2 }}>+ <Section+ variant="highlight"+ accentColor={data.accentColor}+ spacing="sm"+ style={{ margin: 0 }}+ >+ <Text+ style={styles.label}+ color="mutedForeground"+ transform="uppercase"+ noMargin+ >+ Essential Question+ </Text>+ <Text noMargin variant="xs">+ {data.essentialQuestion}+ </Text>+ </Section>+ </View>+ ) : null}+ </Section>++ <Section spacing="none" style={styles.section}>+ <Text+ style={styles.label}+ color="mutedForeground"+ transform="uppercase"+ noMargin+ >+ Objectives+ </Text>+ <PdfList+ variant="bullet"+ gap="xs"+ items={data.objectives.map((o) => ({ text: `SWBAT ${o}` }))}+ />+ </Section>++ {data.standards ? (+ <Section spacing="none" style={styles.section}>+ <Text+ style={styles.label}+ color="mutedForeground"+ transform="uppercase"+ noMargin+ >+ Standards+ </Text>+ <PdfList+ variant="bullet"+ gap="xs"+ items={data.standards.map((s) => ({ text: s }))}+ />+ </Section>+ ) : null}++ <Section spacing="none" style={styles.section}>+ <Text+ style={styles.label}+ color="mutedForeground"+ transform="uppercase"+ noMargin+ >+ Materials+ </Text>+ <PdfList+ variant="bullet"+ gap="xs"+ items={data.materials.map((m) => ({ text: m }))}+ />+ </Section>+ </View>+ </Page>++ <Page+ margin={{+ bottom: theme.spacing.page.marginBottom,+ left: theme.spacing.page.marginLeft,+ right: theme.spacing.page.marginRight,+ top: theme.spacing.page.marginTop,+ }}+ size="A4"+ >+ <PageFooter+ leftText={`${data.teacherName}`}+ rightText="Page 2 of 2"+ sticky+ pagePadding={25}+ />+ <View style={styles.page as never}>+ <Section spacing="none" style={styles.section}>+ <Text+ style={styles.label}+ color="mutedForeground"+ transform="uppercase"+ noMargin+ >+ Lesson Sequence+ </Text>+ <Table variant="grid" zebraStripe>+ <TableHeader>+ <TableRow header>+ <TableCell>Time</TableCell>+ <TableCell>Activity</TableCell>+ <TableCell>Description</TableCell>+ <TableCell>Notes</TableCell>+ </TableRow>+ </TableHeader>+ <TableBody>+ {data.sequence.map((item, index) => (+ // biome-ignore lint/suspicious/noArrayIndexKey: sequence items have no stable id+ <TableRow key={index}>+ <TableCell>{item.time}</TableCell>+ <TableCell>{item.activity}</TableCell>+ <TableCell>{item.description}</TableCell>+ <TableCell>{item.notes ?? ""}</TableCell>+ </TableRow>+ ))}+ </TableBody>+ </Table>+ </Section>++ {data.differentiation ? (+ <Section spacing="none" style={styles.section}>+ <Text+ style={styles.label}+ color="mutedForeground"+ transform="uppercase"+ noMargin+ >+ Differentiation+ </Text>+ <PdfList+ variant="bullet"+ gap="xs"+ items={data.differentiation.map((d) => ({ text: d }))}+ />+ </Section>+ ) : null}++ <Section+ noWrap+ spacing="none"+ style={{ ...styles.row, ...styles.section }}+ >+ <View style={styles.col}>+ <Text+ style={styles.label}+ color="mutedForeground"+ transform="uppercase"+ noMargin+ >+ Formative Assessment+ </Text>+ {data.assessment.formative ? (+ <PdfList+ variant="bullet"+ gap="xs"+ items={data.assessment.formative.map((a) => ({ text: a }))}+ />+ ) : (+ <Text noMargin variant="xs" color="mutedForeground">+ None+ </Text>+ )}+ </View>+ <View style={styles.col}>+ <Text+ style={styles.label}+ color="mutedForeground"+ transform="uppercase"+ noMargin+ >+ Summative Assessment+ </Text>+ {data.assessment.summative ? (+ <PdfList+ variant="bullet"+ gap="xs"+ items={data.assessment.summative.map((a) => ({ text: a }))}+ />+ ) : (+ <Text noMargin variant="xs" color="mutedForeground">+ None+ </Text>+ )}+ </View>+ </Section>++ {data.homework ? (+ <Section spacing="none" style={styles.section}>+ <Text+ style={styles.label}+ color="mutedForeground"+ transform="uppercase"+ noMargin+ >+ Homework+ </Text>+ <Text noMargin variant="xs">+ {data.homework}+ </Text>+ </Section>+ ) : null}++ {data.reflection ? (+ <Section spacing="none" style={styles.section}>+ <Text+ style={styles.label}+ color="mutedForeground"+ transform="uppercase"+ noMargin+ >+ Reflection Notes+ </Text>+ <Text noMargin variant="xs">+ {data.reflection}+ </Text>+ </Section>+ ) : null}+ </View>+ </Page>+ </Document>+ );+};++export const LessonPlanDocument = ({+ theme,+ data = sampleData,+}: {+ theme?: PdfcnTheme;+ data?: LessonPlanData;+}) => (+ <PdfcnThemeProvider theme={theme}>+ <LessonPlanContent data={data} />+ </PdfcnThemeProvider>+);diff --git a/apps/web/registry/bases/forme/blocks/lesson-plan/lesson-plan.types.ts b/apps/web/registry/bases/forme/blocks/lesson-plan/lesson-plan.types.tsnew file mode 100644index 0000000..cccc71c--- /dev/null+++ b/apps/web/registry/bases/forme/blocks/lesson-plan/lesson-plan.types.ts@@ -0,0 +1,32 @@+export interface LessonPlanSequenceItem {+ time: string;+ activity: string;+ description: string;+ notes?: string;+}++export interface LessonPlanAssessment {+ formative?: string[];+ summative?: string[];+}++export interface LessonPlanData {+ subject: string;+ gradeLevel: string;+ lessonTitle: string;+ date: string;+ teacherName: string;+ duration: string;+ topic: string;+ essentialQuestion?: string;+ objectives: string[];+ standards?: string[];+ materials: string[];+ sequence: LessonPlanSequenceItem[];+ differentiation?: string[];+ assessment: LessonPlanAssessment;+ homework?: string;+ reflection?: string;+ accentColor?: string;+ renderingBase?: "takumi" | "forme";+}