This commit is contained in:
2026-03-19 14:09:28 -05:00
parent 8be2a15401
commit 507caba410
21 changed files with 650 additions and 1367 deletions

35
src/section.ts Normal file
View File

@@ -0,0 +1,35 @@
import { Request } from 'express';
import HeroSection from './sections/hero';
import { Template } from './template';
const SECTION_TYPES = <const>{
'hero': HeroSection
}
export type Section<P> = {
properties:P;
render:(params:{ properties:P, template:Template }) => string;
};
export type SectionType = keyof typeof SECTION_TYPES;
export type SectionTypeFor<T extends SectionType> = (
typeof SECTION_TYPES[T]
);
export type SectionProperties<T extends SectionType> = (
SectionTypeFor<T>['properties']
);
export type SectionData<T extends SectionType> = {
type:T;
properties:SectionProperties<T>;
}
export const sectionRender = async (p:{
request:Request,
section:SectionData<SectionType>;
template:Template;
}):Promise<string> => {
return '';
}