🎥 Make videos programmatically with React
make templates use design system
JonnyBurger1b88dd4f8ac3
diff --git a/packages/docs/src/pages/templates/index.tsx b/packages/docs/src/pages/templates/index.tsxindex 323bd2842f..24ca2f95ee 100644--- a/packages/docs/src/pages/templates/index.tsx+++ b/packages/docs/src/pages/templates/index.tsx@@ -1,85 +1,9 @@import Head from '@docusaurus/Head';-import Link from '@docusaurus/Link';import useDocusaurusContext from '@docusaurus/useDocusaurusContext';+import {Templates} from '@remotion/promo-pages/dist/templates.js';import Layout from '@theme/Layout';-import {CreateVideoInternals} from 'create-video';import React from 'react';-import {IconForTemplate} from '../../components/IconForTemplate';import {Seo} from '../../components/Seo';-import {EditorIcon} from '../../components/icons/editor';-import {SkiaIcon} from '../../components/icons/skia';-import {TimelineIcon} from '../../components/icons/timeline';-import styles from './styles.module.css';--const content: React.CSSProperties = {- maxWidth: 1000,- margin: 'auto',- padding: '0 20px',-};--const para: React.CSSProperties = {- textAlign: 'center',- marginBottom: 50,-};--const lowerpara: React.CSSProperties = {- textAlign: 'center',- color: 'var(--light-text-color)',-};--const outer: React.CSSProperties = {- display: 'flex',- cursor: 'pointer',- color: 'var(--text-color)',- textDecoration: 'none',-};--const icon: React.CSSProperties = {- display: 'flex',- margin: 0,- marginRight: 10,- height: 30,- width: 30,- justifyContent: 'center',- alignItems: 'center',-};--const labelStyle: React.CSSProperties = {- fontWeight: 'bold',-};--const descriptionStyle: React.CSSProperties = {- fontSize: 14,- marginTop: 10,- color: 'var(--light-text-color)',- marginBottom: 10,-};--const Item: React.FC<{- readonly label: string;- readonly description: string;- readonly children: React.ReactNode;-}> = ({children, label, description}) => {- return (- <div>- <div- style={{flexDirection: 'row', display: 'flex', alignItems: 'center'}}- >- <div style={icon}>{children}</div>- <div style={labelStyle}>{label}</div>- </div>- <div>- <p- // eslint-disable-next-line react/no-danger- dangerouslySetInnerHTML={{- __html: description,- }}- style={descriptionStyle}- />- </div>- </div>- );-};export default () => {const imgSrc = `/generated/template-all.png`;@@ -94,124 +18,7 @@ export default () => {)}{Seo.renderImage(imgSrc, context.siteConfig.url)}</Head>- <div style={content}>- <h1 className={styles.title}>- Find the right- <br />- template- </h1>- <p style={para}>- Jumpstart your project with a template that fits your usecase.- </p>- <h3>Free templates</h3>- <div className={styles.grid}>- {CreateVideoInternals.FEATURED_TEMPLATES.map((template) => {- return (- <Link- key={template.cliId}- className={styles.item}- style={outer}- to={`/templates/${template.cliId}`}- >- <Item- label={template.homePageLabel}- description={template.description}- >- <IconForTemplate scale={0.7} template={template} />- </Item>- </Link>- );- })}- </div>- <br />- <br />- <h3>Paid templates</h3>- <div className={styles.grid}>- <Link- key={'editor-starter'}- className={styles.item}- style={outer}- to={`https://www.remotion.pro/editor-starter`}- >- <Item- label={'Editor Starter'}- description={'A boilerplate for starting your own video editor'}- >- <EditorIcon- style={{- height: 0.7 * 32,- overflow: 'visible',- }}- />- </Item>{' '}- </Link>- <Link- key={'mapbox-globe'}- className={styles.item}- style={outer}- to={`https://www.remotion.pro/mapbox-globe`}- >- <Item- label={'Mapbox Globe'}- description={'A rotateable and zoomeable 3D Globe'}- >- <svg- style={{height: 0.7 * 36, overflow: 'visible'}}- viewBox="0 0 512 512"- >- <path- fill="currentcolor"- d="M256 464c7.4 0 27-7.2 47.6-48.4c8.8-17.7 16.4-39.2 22-63.6H186.4c5.6 24.4 13.2 45.9 22 63.6C229 456.8 248.6 464 256 464zM178.5 304h155c1.6-15.3 2.5-31.4 2.5-48s-.9-32.7-2.5-48h-155c-1.6 15.3-2.5 31.4-2.5 48s.9 32.7 2.5 48zm7.9-144H325.6c-5.6-24.4-13.2-45.9-22-63.6C283 55.2 263.4 48 256 48s-27 7.2-47.6 48.4c-8.8 17.7-16.4 39.2-22 63.6zm195.3 48c1.5 15.5 2.2 31.6 2.2 48s-.8 32.5-2.2 48h76.7c3.6-15.4 5.6-31.5 5.6-48s-1.9-32.6-5.6-48H381.8zm58.8-48c-21.4-41.1-56.1-74.1-98.4-93.4c14.1 25.6 25.3 57.5 32.6 93.4h65.9zm-303.3 0c7.3-35.9 18.5-67.7 32.6-93.4c-42.3 19.3-77 52.3-98.4 93.4h65.9zM53.6 208c-3.6 15.4-5.6 31.5-5.6 48s1.9 32.6 5.6 48h76.7c-1.5-15.5-2.2-31.6-2.2-48s.8-32.5 2.2-48H53.6zM342.1 445.4c42.3-19.3 77-52.3 98.4-93.4H374.7c-7.3 35.9-18.5 67.7-32.6 93.4zm-172.2 0c-14.1-25.6-25.3-57.5-32.6-93.4H71.4c21.4 41.1 56.1 74.1 98.4 93.4zM256 512A256 256 0 1 1 256 0a256 256 0 1 1 0 512z"- />- </svg>- </Item>- </Link>- <Link- key={'watercolor-map'}- className={styles.item}- style={outer}- to={`https://www.remotion.pro/watercolor-map`}- >- <Item- label={'Watercolor Map'}- description={'A beautiful 2D map for travel videos'}- >- <SkiaIcon- style={{- height: 0.7 * 32,- overflow: 'visible',- }}- />- </Item>- </Link>- <Link- key={'timeline'}- className={styles.item}- style={outer}- to={`https://www.remotion.pro/timeline`}- >- <Item- label={'<Timeline />'}- description={- 'A copy pasteable component for timeline-based editing'- }- >- <TimelineIcon- style={{- height: 0.7 * 32,- }}- />- </Item>- </Link>- </div>-- <br />- <p style={lowerpara}>- {"Couldn't"} find what you need? Check out the list of{' '}- <Link to={'/docs/resources'}>Resources</Link>.- </p>- </div>- <br />+ <Templates /></Layout>);};diff --git a/packages/promo-pages/bundle.ts b/packages/promo-pages/bundle.tsindex 757044088f..1efc6e2f0b 100644--- a/packages/promo-pages/bundle.ts+++ b/packages/promo-pages/bundle.ts@@ -29,6 +29,7 @@ const result = await build({'./src/components/homepage/Pricing.tsx','./src/components/team.tsx','./src/components/design.tsx',+ './src/components/templates.tsx',],outdir: 'dist',format: 'esm',diff --git a/packages/promo-pages/src/components/icons/editor.tsx b/packages/promo-pages/src/components/icons/editor.tsxnew file mode 100644index 0000000000..e2b629ae5b--- /dev/null+++ b/packages/promo-pages/src/components/icons/editor.tsx@@ -0,0 +1,54 @@+import type {SVGProps} from 'react';+import React from 'react';++export const EditorIcon: React.FC<SVGProps<SVGSVGElement>> = (props) => {+ return (+ <svg+ viewBox="0 0 251 251"+ fill="none"+ xmlns="http://www.w3.org/2000/svg"+ {...props}+ >+ <rect+ x="4"+ y="4"+ width="52"+ height="52"+ rx="15"+ stroke="currentColor"+ strokeWidth="16"+ />+ <rect+ x="195"+ y="4"+ width="52"+ height="52"+ rx="15"+ stroke="currentColor"+ strokeWidth="16"+ />+ <rect+ x="4"+ y="195"+ width="52"+ height="52"+ rx="15"+ stroke="currentColor"+ strokeWidth="16"+ />+ <rect+ x="195"+ y="195"+ width="52"+ height="52"+ rx="15"+ stroke="currentColor"+ strokeWidth="16"+ />+ <path d="M55 222H196" stroke="currentColor" strokeWidth="16" />+ <path d="M30 60L30 191" stroke="currentColor" strokeWidth="16" />+ <path d="M221 60V191" stroke="currentColor" strokeWidth="16" />+ <path d="M55 30H196" stroke="currentColor" strokeWidth="16" />+ </svg>+ );+};diff --git a/packages/promo-pages/src/components/icons/timeline.tsx b/packages/promo-pages/src/components/icons/timeline.tsxnew file mode 100644index 0000000000..d37a5cb05a--- /dev/null+++ b/packages/promo-pages/src/components/icons/timeline.tsx@@ -0,0 +1,27 @@+import type {SVGProps} from 'react';+import React from 'react';++export const TimelineIcon: React.FC<SVGProps<SVGSVGElement>> = (props) => {+ return (+ <svg+ {...props}+ viewBox="0 0 56 69"+ fill="none"+ xmlns="http://www.w3.org/2000/svg"+ >+ <path+ d="M51.4313 38.0917L31.4998 52.4424C30.2419 53.3481 28.5581 53.3925 27.2543 52.5543L4.73299 38.0763C3.65291 37.382 3 36.1861 3 34.9021V6.77359C3 4.68949 4.68949 3 6.77358 3H49.2264C51.3105 3 53 4.68949 53 6.77358V35.0293C53 36.243 52.4163 37.3826 51.4313 38.0917Z"+ stroke="currentcolor"+ strokeWidth="5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <path+ d="M29 55L29 66"+ stroke="currentcolor"+ strokeWidth="5"+ strokeLinecap="square"+ />+ </svg>+ );+};diff --git a/packages/docs/src/pages/templates/styles.module.css b/packages/promo-pages/src/components/templates.module.csssimilarity index 100%rename from packages/docs/src/pages/templates/styles.module.cssrename to packages/promo-pages/src/components/templates.module.cssdiff --git a/packages/promo-pages/src/components/templates.tsx b/packages/promo-pages/src/components/templates.tsxnew file mode 100644index 0000000000..5912e187e1--- /dev/null+++ b/packages/promo-pages/src/components/templates.tsx@@ -0,0 +1,202 @@+import {CreateVideoInternals} from 'create-video';+import React from 'react';+import {IconForTemplate} from './homepage/IconForTemplate';+import {EditorIcon} from './icons/editor';+import {SkiaIcon} from './icons/skia';+import {TimelineIcon} from './icons/timeline';+import styles from './templates.module.css';++const content: React.CSSProperties = {+ maxWidth: 1000,+ margin: 'auto',+ padding: '0 20px',+};++const para: React.CSSProperties = {+ textAlign: 'center',+ marginBottom: 50,+};++const lowerpara: React.CSSProperties = {+ textAlign: 'center',+ color: 'var(--light-text-color)',+};++const outer: React.CSSProperties = {+ display: 'flex',+ cursor: 'pointer',+ color: 'var(--text-color)',+ textDecoration: 'none',+};++const icon: React.CSSProperties = {+ display: 'flex',+ margin: 0,+ marginRight: 10,+ height: 30,+ width: 30,+ justifyContent: 'center',+ alignItems: 'center',+};++const labelStyle: React.CSSProperties = {+ fontWeight: 'bold',+};++const descriptionStyle: React.CSSProperties = {+ fontSize: 14,+ marginTop: 10,+ color: 'var(--light-text-color)',+ marginBottom: 10,+};++const Item: React.FC<{+ readonly label: string;+ readonly description: string;+ readonly children: React.ReactNode;+}> = ({children, label, description}) => {+ return (+ <div>+ <div+ style={{flexDirection: 'row', display: 'flex', alignItems: 'center'}}+ >+ <div style={icon}>{children}</div>+ <div style={labelStyle}>{label}</div>+ </div>+ <div>+ <p+ // eslint-disable-next-line react/no-danger+ dangerouslySetInnerHTML={{+ __html: description,+ }}+ style={descriptionStyle}+ />+ </div>+ </div>+ );+};++export const Templates: React.FC = () => {+ return (+ <>+ <div style={content}>+ <h1 className={styles.title}>+ Find the right+ <br />+ template+ </h1>+ <p style={para}>+ Jumpstart your project with a template that fits your usecase.+ </p>+ <h3>Free templates</h3>+ <div className={styles.grid}>+ {CreateVideoInternals.FEATURED_TEMPLATES.map((template) => {+ return (+ <a+ key={template.cliId}+ className={styles.item}+ style={outer}+ href={`/templates/${template.cliId}`}+ >+ <Item+ label={template.homePageLabel}+ description={template.description}+ >+ <IconForTemplate scale={0.7} template={template} />+ </Item>+ </a>+ );+ })}+ </div>+ <br />+ <br />+ <h3>Paid templates</h3>+ <div className={styles.grid}>+ <a+ key={'editor-starter'}+ className={styles.item}+ style={outer}+ href={`https://www.remotion.pro/editor-starter`}+ >+ <Item+ label={'Editor Starter'}+ description={'A boilerplate for starting your own video editor'}+ >+ <EditorIcon+ style={{+ height: 0.7 * 32,+ overflow: 'visible',+ }}+ />+ </Item>{' '}+ </a>+ <a+ key={'mapbox-globe'}+ className={styles.item}+ style={outer}+ href={`https://www.remotion.pro/mapbox-globe`}+ >+ <Item+ label={'Mapbox Globe'}+ description={'A rotateable and zoomeable 3D Globe'}+ >+ <svg+ style={{height: 0.7 * 36, overflow: 'visible'}}+ viewBox="0 0 512 512"+ >+ <path+ fill="currentcolor"+ d="M256 464c7.4 0 27-7.2 47.6-48.4c8.8-17.7 16.4-39.2 22-63.6H186.4c5.6 24.4 13.2 45.9 22 63.6C229 456.8 248.6 464 256 464zM178.5 304h155c1.6-15.3 2.5-31.4 2.5-48s-.9-32.7-2.5-48h-155c-1.6 15.3-2.5 31.4-2.5 48s.9 32.7 2.5 48zm7.9-144H325.6c-5.6-24.4-13.2-45.9-22-63.6C283 55.2 263.4 48 256 48s-27 7.2-47.6 48.4c-8.8 17.7-16.4 39.2-22 63.6zm195.3 48c1.5 15.5 2.2 31.6 2.2 48s-.8 32.5-2.2 48h76.7c3.6-15.4 5.6-31.5 5.6-48s-1.9-32.6-5.6-48H381.8zm58.8-48c-21.4-41.1-56.1-74.1-98.4-93.4c14.1 25.6 25.3 57.5 32.6 93.4h65.9zm-303.3 0c7.3-35.9 18.5-67.7 32.6-93.4c-42.3 19.3-77 52.3-98.4 93.4h65.9zM53.6 208c-3.6 15.4-5.6 31.5-5.6 48s1.9 32.6 5.6 48h76.7c-1.5-15.5-2.2-31.6-2.2-48s.8-32.5 2.2-48H53.6zM342.1 445.4c42.3-19.3 77-52.3 98.4-93.4H374.7c-7.3 35.9-18.5 67.7-32.6 93.4zm-172.2 0c-14.1-25.6-25.3-57.5-32.6-93.4H71.4c21.4 41.1 56.1 74.1 98.4 93.4zM256 512A256 256 0 1 1 256 0a256 256 0 1 1 0 512z"+ />+ </svg>+ </Item>+ </a>+ <a+ key={'watercolor-map'}+ className={styles.item}+ style={outer}+ href={`https://www.remotion.pro/watercolor-map`}+ >+ <Item+ label={'Watercolor Map'}+ description={'A beautiful 2D map for travel videos'}+ >+ <SkiaIcon+ style={{+ height: 0.7 * 32,+ overflow: 'visible',+ }}+ />+ </Item>+ </a>+ <a+ key={'timeline'}+ className={styles.item}+ style={outer}+ href={`https://www.remotion.pro/timeline`}+ >+ <Item+ label={'<Timeline />'}+ description={+ 'A copy pasteable component for timeline-based editing'+ }+ >+ <TimelineIcon+ style={{+ height: 0.7 * 32,+ }}+ />+ </Item>+ </a>+ </div>++ <br />+ <p style={lowerpara}>+ {"Couldn't"} find what you need? Check out the list of{' '}+ <a href={'/docs/resources'}>Resources</a>.+ </p>+ </div>+ <br />+ </>+ );+};