Skip to content

🎥 Make videos programmatically with React

Add preview link for templates

MehmetAdemiafb7906d1a47
diff --git a/packages/create-video/src/templates.tsx b/packages/create-video/src/templates.tsx
index 1c01e079f6..b908a99717 100644
--- a/packages/create-video/src/templates.tsx
+++ b/packages/create-video/src/templates.tsx
@@ -45,6 +45,7 @@ export type Template = {
| 'tiktok';
defaultBranch: string;
featuredOnHomePage: string | null;
+ previewURL?: string | null;
} & DynamicTemplate;
type Truthy<T> = T extends false | '' | 0 | null | undefined ? never : T;
@@ -72,6 +73,7 @@ export const FEATURED_TEMPLATES: Template[] = [
type: 'video' as const,
defaultBranch: 'main',
featuredOnHomePage: 'Hello World',
+ previewURL: 'https://remotion-helloworld.vercel.app/?/HelloWorld',
},
{
homePageLabel: 'Next.js (App dir)',
@@ -145,6 +147,7 @@ export const FEATURED_TEMPLATES: Template[] = [
type: 'video' as const,
defaultBranch: 'main',
featuredOnHomePage: 'Blank',
+ previewURL: 'https://template-empty.vercel.app/?/MyComp',
},
{
homePageLabel: 'JavaScript',
@@ -163,6 +166,8 @@ export const FEATURED_TEMPLATES: Template[] = [
type: 'video' as const,
defaultBranch: 'main',
featuredOnHomePage: 'JavaScript',
+ previewURL:
+ 'https://template-helloworld-javascript.vercel.app/?/HelloWorld',
},
{
homePageLabel: 'Remix',
@@ -199,6 +204,7 @@ export const FEATURED_TEMPLATES: Template[] = [
type: 'video' as const,
defaultBranch: 'main',
featuredOnHomePage: null,
+ previewURL: 'https://template-three-remotion.vercel.app/',
},
{
homePageLabel: 'Stills',
@@ -217,6 +223,7 @@ export const FEATURED_TEMPLATES: Template[] = [
type: 'video' as const,
defaultBranch: 'main',
featuredOnHomePage: null,
+ previewURL: 'https://template-still.vercel.app/?/PreviewCard',
},
{
homePageLabel: 'Text-To-Speech (Azure)',
@@ -329,6 +336,7 @@ export const FEATURED_TEMPLATES: Template[] = [
type: 'video' as const,
defaultBranch: 'main',
featuredOnHomePage: null,
+ previewURL: 'https://template-tailwind-remotion.vercel.app/?/MyComp',
},
{
homePageLabel: 'Stargazer',
diff --git a/packages/docs/src/components/TemplateModalContent.tsx b/packages/docs/src/components/TemplateModalContent.tsx
index 11fa3dcfed..5eaf3a8e2e 100644
--- a/packages/docs/src/components/TemplateModalContent.tsx
+++ b/packages/docs/src/components/TemplateModalContent.tsx
@@ -75,6 +75,17 @@ const StackBlitzIcon: React.FC = () => {
);
};
+const PreviewIcon: React.FC = () => {
+ return (
+ <svg viewBox="0 0 512 512" aria-hidden="true" width="24" height="24">
+ <path
+ fill="currentColor"
+ d="M368 208A160 160 0 1 0 48 208a160 160 0 1 0 320 0zM337.1 371.1C301.7 399.2 256.8 416 208 416C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208c0 48.8-16.8 93.7-44.9 129.1l124 124 17 17L478.1 512l-17-17-124-124zM145.8 116.2l24 14 110.2 64L303.9 208 280 221.8l-110.2 64-24 14V272 144 116.2z"
+ />
+ </svg>
+ );
+};
+
const spinner: React.CSSProperties = {
height: 16,
width: 16,
@@ -307,6 +318,25 @@ export const TemplateModalContent: React.FC<{
View source
</a>
</div>
+ {template.previewURL && (
+ <a target={"_blank"} style={link} href={template.previewURL}>
+ <div style={githubrow}>
+ <div style={iconContainer}>
+ <PreviewIcon />
+ </div>
+ See Preview{" "}
+ <span
+ style={{
+ whiteSpace: "pre",
+ color: "var(--light-text-color)",
+ }}
+ >
+ {" "}
+ via Remotion Studio
+ </span>
+ </div>
+ </a>
+ )}
<a
target={"_blank"}
style={link}