Merge branch 'feat/custom_schema_and_layout' of github.com:presenton/presenton into feat/custom_schema_and_layout

This commit is contained in:
shiva raj badu 2025-07-24 23:47:11 +05:45
commit 1ecd5c164b
No known key found for this signature in database
3 changed files with 33 additions and 37 deletions

View file

@ -47,7 +47,7 @@ export const Schema = z.object({
type SchemaType = z.infer<typeof Schema>;
export default function ExampleComponent({ data }: { data: SchemaType }) {
export default function ExampleSlideLayout({ data }: { data: SchemaType }) {
const { title, subtitle, metrics, chartImage, trendIcon } = data;
return (
<div className="aspect-video max-w-[1280px] w-full bg-white">

View file

@ -0,0 +1,32 @@
import * as z from "zod";
// Note:
// If you want to use images and icons, you must use ImageSchema and IconSchema
// Images and icons are the only media types supported for PDF and PPTX exports
import { ImageSchema, IconSchema } from "./defaultSchemes";
// Schema definition
export const Schema = z.object({
// Notes:
// Schema fields
// Each field must have a default value (this is important for Layout Preview)
// Each field must have a meta description
// Each field must have a minimum and maximum length
// Each array field must have a minimum and maximum number of items
})
// Type inference
type SchemaType = z.infer<typeof Schema>;
// Component definition
const SlideComponent = ({ data }: { data: Partial<SchemaType> }) => {
// Notes:
// Must have consistent aspect ratio (16:9) and max-width of 1280px.
// Validate each data field before rendering using && operator or optional chaining.
// These layouts are exported as PDF and PPTX so they must be optimized for both formats.
// Content must properly fit in the container, specify min and max constraints in the schema.
// You can check out ExampleComponent.tsx for more details.
};
export default SlideComponent;

View file

@ -1,36 +0,0 @@
import * as z from "zod";
// Note:
// If you want to use Image and Icon Must Use these Schemas.
// Image and icons are only media support for PDF and PPTX.
import { ImageSchema, IconSchema } from "./defaultSchemes";
// Schema definition
export const Schema = z.object({
// Note:
// Schema fields
// Each fields must have a default value (this is important for Layout-preview)
// Each fields must have a meta description
// Each fields must have a min and max length, length must support the layout design.
// Each Array fields must have a min and max length
})
// Type inference
type SchemaType = z.infer<typeof Schema>;
// Component definition
const SlideStructure = ({ data }: { data: Partial<SchemaType> }) => {
// Note:
// Data is already parse so not need to parse again.
// Must have consistent aspect ratio (16:9) and max-width 1280px.
// Validate each data before rendering using && operator or optional chaining
// These layout are exported as PDF and PPTX so must be optimized for both.
// Component design, layout, styles, etc.
// Content must be properly fit in the container, if need adjust the lenght of the content and items in Schema.
// See ExampleComponent.tsx for more details.
// Font Size must fit the desing and and the content must be properly fit in the container.
};
export default SlideStructure;