import React from "react"; import * as z from "zod"; export const layoutId = "table-of-contents"; export const layoutName = "Table Of Contents"; export const layoutDescription = "A clean table of contents layout with up to 10 items, each with a short description, styled to match the modern template."; const TocItemSchema = z.object({ title: z.string().min(3).max(40).meta({ description: "Item title (short)", }), description: z.string().min(10).max(80).meta({ description: "Short item description", }), }); const tableOfContentsSchema = z.object({ title: z.string().min(3).max(40).default("Table Of Contents").meta({ description: "Main title displayed at the top", }), items: z .array(TocItemSchema) .min(2) .max(10) .default( Array.from({ length: 10 }).map((_, i) => ({ title: `Section ${i + 1}`, description: "Brief description for this section.", })) ) .meta({ description: "List of up to 10 TOC items" }), }); export const Schema = tableOfContentsSchema; export type TableOfContentsData = z.infer; interface TableOfContentsLayoutProps { data?: Partial; } const TableOfContentsLayout: React.FC = ({ data: slideData, }) => { const items = slideData?.items?.slice(0, 10) || []; return ( <> {/* Import Montserrat Font */}
{/* Header */} {((slideData as any)?.__companyName__ || (slideData as any)?._logo_url__) && (
{(slideData as any)?._logo_url__ && logo} {(slideData as any)?.__companyName__ && {(slideData as any)?.__companyName__ || 'Company Name'} }
)} {/* Title */}

{slideData?.title}

{/* TOC Grid */}
{items.map((item, idx) => (
{idx + 1}
{item.title}
{item.description}
))}
{/* Bottom Divider */}
); }; export default TableOfContentsLayout;