🎥 Make videos programmatically with React
Next.js App Directory templte
Jonny Burger2d88765f9e3b
diff --git a/packages/create-video/src/templates.tsx b/packages/create-video/src/templates.tsxindex 18038c3196..036ca12c4a 100644--- a/packages/create-video/src/templates.tsx+++ b/packages/create-video/src/templates.tsx@@ -30,6 +30,7 @@ export type Template = {| 'javascript'| 'blank'| 'next'+ | 'next-pages-dir'| 'remix'| 'three'| 'still'@@ -41,6 +42,7 @@ export type Template = {| 'overlay'| 'stargazer';defaultBranch: string;+ featuredOnHomePage: string | null;} & DynamicTemplate;type Truthy<T> = T extends false | '' | 0 | null | undefined ? never : T;@@ -67,12 +69,31 @@ export const FEATURED_TEMPLATES: Template[] = [cliId: 'hello-world' as const,type: 'video' as const,defaultBranch: 'main',+ featuredOnHomePage: 'Hello World',},{- homePageLabel: 'Next.js',- shortName: 'Next.js',+ homePageLabel: 'Next.js (Pages dir)',+ shortName: 'Next.js (Pages dir)',org: 'remotion-dev',- repoName: 'template-next',+ repoName: 'template-next-pages-dir',+ description: 'SaaS template for video generation apps',+ longerDescription:+ 'A SaaS starter kit which has the Remotion Player and rendering via Remotion Lambda built-in. Our recommended choice for people who want to build an app that can generate videos.',+ promoVideo: {+ width: 1280,+ height: 720,+ muxId: 'RufnZIJZh6L1MAaeG02jnXuM9pK96tNuHRxmXHbWqCBI',+ },+ cliId: 'next-pages-dir' as const,+ type: 'video' as const,+ defaultBranch: 'main',+ featuredOnHomePage: null,+ },+ {+ homePageLabel: 'Next.js (App dir)',+ shortName: 'Next.js (App dir)',+ org: 'remotion-dev',+ repoName: 'template-next-app-dir',description: 'SaaS template for video generation apps',longerDescription:'A SaaS starter kit which has the Remotion Player and rendering via Remotion Lambda built-in. Our recommended choice for people who want to build an app that can generate videos.',@@ -84,6 +105,7 @@ export const FEATURED_TEMPLATES: Template[] = [cliId: 'next' as const,type: 'video' as const,defaultBranch: 'main',+ featuredOnHomePage: 'Next.js',},{homePageLabel: 'Blank',@@ -101,6 +123,7 @@ export const FEATURED_TEMPLATES: Template[] = [cliId: 'blank' as const,type: 'video' as const,defaultBranch: 'main',+ featuredOnHomePage: 'Blank',},{homePageLabel: 'JavaScript',@@ -118,6 +141,7 @@ export const FEATURED_TEMPLATES: Template[] = [cliId: 'javascript' as const,type: 'video' as const,defaultBranch: 'main',+ featuredOnHomePage: 'JavaScript',},{homePageLabel: 'Remix',@@ -135,6 +159,7 @@ export const FEATURED_TEMPLATES: Template[] = [cliId: 'remix' as const,type: 'image' as const,defaultBranch: 'main',+ featuredOnHomePage: null,},{homePageLabel: '3D',@@ -152,6 +177,7 @@ export const FEATURED_TEMPLATES: Template[] = [cliId: 'three' as const,type: 'video' as const,defaultBranch: 'main',+ featuredOnHomePage: null,},{homePageLabel: 'Stills',@@ -169,6 +195,7 @@ export const FEATURED_TEMPLATES: Template[] = [cliId: 'still' as const,type: 'video' as const,defaultBranch: 'main',+ featuredOnHomePage: null,},{homePageLabel: 'Text-To-Speech (Azure)',@@ -186,6 +213,7 @@ export const FEATURED_TEMPLATES: Template[] = [cliId: 'tts' as const,type: 'video' as const,defaultBranch: 'master',+ featuredOnHomePage: null,},{homePageLabel: 'Text-To-Speech (Google)',@@ -203,6 +231,7 @@ export const FEATURED_TEMPLATES: Template[] = [cliId: 'google-tts' as const,type: 'video' as const,defaultBranch: 'master',+ featuredOnHomePage: null,},{homePageLabel: 'Audiogram',@@ -220,6 +249,7 @@ export const FEATURED_TEMPLATES: Template[] = [cliId: 'audiogram' as const,type: 'video' as const,defaultBranch: 'main',+ featuredOnHomePage: null,},{homePageLabel: 'Skia',@@ -236,6 +266,7 @@ export const FEATURED_TEMPLATES: Template[] = [cliId: 'skia' as const,type: 'video' as const,defaultBranch: 'main',+ featuredOnHomePage: null,},{homePageLabel: 'Tailwind',@@ -253,8 +284,8 @@ export const FEATURED_TEMPLATES: Template[] = [cliId: 'tailwind' as const,type: 'video' as const,defaultBranch: 'main',+ featuredOnHomePage: null,},-{homePageLabel: 'Overlay',shortName: 'Overlay',@@ -276,6 +307,7 @@ export const FEATURED_TEMPLATES: Template[] = [cliId: 'overlay' as const,type: 'video' as const,defaultBranch: 'main',+ featuredOnHomePage: null,},{homePageLabel: 'Stargazer',@@ -293,5 +325,6 @@ export const FEATURED_TEMPLATES: Template[] = [cliId: 'stargazer' as const,type: 'video' as const,defaultBranch: 'main',+ featuredOnHomePage: null,},].filter(truthy);diff --git a/packages/docs/src/components/ChooseTemplate.tsx b/packages/docs/src/components/ChooseTemplate.tsxindex 2740db2015..5dd90c2155 100644--- a/packages/docs/src/components/ChooseTemplate.tsx+++ b/packages/docs/src/components/ChooseTemplate.tsx@@ -35,21 +35,21 @@ export const ChooseTemplate: React.FC = () => {maxWidth: "550px",}}>- {CreateVideoInternals.FEATURED_TEMPLATES.slice(0, 4).map(- (template) => {- return (- <Link- key={template.cliId}- style={{ textDecoration: "none" }}- to={`/templates/${template.cliId}`}- >- <TemplateIcon label={template.homePageLabel}>- <IconForTemplate scale={0.7} template={template} />- </TemplateIcon>- </Link>- );- }- )}+ {CreateVideoInternals.FEATURED_TEMPLATES.filter(+ (f) => f.featuredOnHomePage+ ).map((template) => {+ return (+ <Link+ key={template.cliId}+ style={{ textDecoration: "none" }}+ to={`/templates/${template.cliId}`}+ >+ <TemplateIcon label={template.featuredOnHomePage}>+ <IconForTemplate scale={0.7} template={template} />+ </TemplateIcon>+ </Link>+ );+ })}<MoreTemplatesButton /></div></div>diff --git a/packages/docs/src/components/IconForTemplate.tsx b/packages/docs/src/components/IconForTemplate.tsxindex 131c551f2d..5f626828b0 100644--- a/packages/docs/src/components/IconForTemplate.tsx+++ b/packages/docs/src/components/IconForTemplate.tsx@@ -133,7 +133,7 @@ export const IconForTemplate: React.FC<{return <OverlayIcon style={{ height: scale * 42 }} />;}- if (template.cliId === "next") {+ if (template.cliId === "next" || template.cliId === "next-pages-dir") {return <NextIcon style={{ height: scale * 36 }} />;}diff --git a/packages/docs/src/remotion/AllTemplates.tsx b/packages/docs/src/remotion/AllTemplates.tsxindex 4c262ffa2c..0981701b13 100644--- a/packages/docs/src/remotion/AllTemplates.tsx+++ b/packages/docs/src/remotion/AllTemplates.tsx@@ -61,21 +61,33 @@ export const AllTemplates: React.FC = () => {gridTemplateColumns: "repeat(6, 1fr)",}}>- {CreateVideoInternals.FEATURED_TEMPLATES.map((template) => (- <div- key={template.cliId}- style={{- height: 80,- width: 80,- margin: 20,- justifyContent: "center",- alignItems: "center",- display: "flex",- }}- >- <IconForTemplate scale={1.6} template={template} />- </div>- ))}+ {CreateVideoInternals.FEATURED_TEMPLATES.map((template) => {+ if (template.cliId === "next") {+ // Delete duplicate+ return null;+ }++ if (template.cliId === "google-tts") {+ // Delete duplicate+ return null;+ }++ return (+ <div+ key={template.cliId}+ style={{+ height: 80,+ width: 80,+ margin: 20,+ justifyContent: "center",+ alignItems: "center",+ display: "flex",+ }}+ >+ <IconForTemplate scale={1.6} template={template} />+ </div>+ );+ })}</div></div></div>diff --git a/packages/docs/src/remotion/Template.tsx b/packages/docs/src/remotion/Template.tsxindex 9548311758..d345161646 100644--- a/packages/docs/src/remotion/Template.tsx+++ b/packages/docs/src/remotion/Template.tsx@@ -67,13 +67,19 @@ export const TemplateComp: React.FC<{alignItems: "center",}}>- <IconForTemplate scale={1.6} template={template} />{" "}- <div- style={{- width: 25,- display: "inline-block",- }}- />+ {template.cliId === "next" ||+ template.cliId === "next-pages-dir" ? null : (+ <>+ <IconForTemplate scale={1.6} template={template} />{" "}+ <div+ style={{+ width: 25,+ display: "inline-block",+ }}+ />+ </>+ )}+{template.shortName}</div></div>diff --git a/packages/docs/static/generated/template-all.png b/packages/docs/static/generated/template-all.pngindex e8a15115f8..0bd8813670 100644Binary files a/packages/docs/static/generated/template-all.png and b/packages/docs/static/generated/template-all.png differdiff --git a/packages/docs/static/generated/template-next-pages-dir.png b/packages/docs/static/generated/template-next-pages-dir.pngnew file mode 100644index 0000000000..24f1a2380cBinary files /dev/null and b/packages/docs/static/generated/template-next-pages-dir.png differdiff --git a/packages/docs/static/generated/template-next.png b/packages/docs/static/generated/template-next.pngnew file mode 100644index 0000000000..4104c77365Binary files /dev/null and b/packages/docs/static/generated/template-next.png differ