🎥 Make videos programmatically with React
docs updates
Jonny Burgere13f15b778bc
diff --git a/packages/docs/components/LandingPage/FreePricing.tsx b/packages/docs/components/LandingPage/FreePricing.tsxindex 8146648e8b..182595fbc9 100644--- a/packages/docs/components/LandingPage/FreePricing.tsx+++ b/packages/docs/components/LandingPage/FreePricing.tsx@@ -1,11 +1,11 @@import React from "react";import styled from "styled-components";+import { PricingTable } from "./PricingTable";const Row = styled.div`display: flex;flex-direction: row;- justify-content: flex-end;- text-align: right;+ text-align: center;`;const Title = styled.h2`@@ -24,8 +24,8 @@ const Mp4 = styled.span`export const FreePricing: React.FC = () => {return (- <Row>- <div>+ <>+ <div style={{ textAlign: "center" }}><Title><Mp4>Free</Mp4> for individuals <br /> Funded by companies</Title>@@ -36,6 +36,7 @@ export const FreePricing: React.FC = () => {keep improving the Remotion experience.</p></div>- </Row>+ <PricingTable></PricingTable>+ </>);};diff --git a/packages/docs/components/LandingPage/PricingTable.tsx b/packages/docs/components/LandingPage/PricingTable.tsxnew file mode 100644index 0000000000..ecc40a6ca0--- /dev/null+++ b/packages/docs/components/LandingPage/PricingTable.tsx@@ -0,0 +1,228 @@+import React, { useState } from "react";+import styled, { css } from "styled-components";+import { BlueButton } from "../layout/Button";+import { mobile } from "../layout/layout";+import { Spacer } from "../layout/Spacer";+import { PeriodSelector } from "../PeriodSelector";+import { Triangle } from "../Triangle";++enum Period {+ Monthly = "monthly",+ Yearly = "yearly",+}++const PricingRow = styled.div`+ display: flex;+ flex-direction: row;+ ${mobile`+ flex-direction: column;+ align-items: center;+ `}+`;++const Panel = styled.div`+ background-color: white;+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);+ padding: 10px;+ border-radius: 15px;+ flex: 1;+ text-align: center;+ padding-top: 30px;+ padding-bottom: 10px;+ min-height: 500px;+ display: flex;+ flex-direction: column;+ ul {+ text-align: left;+ list-style-type: none;+ padding-left: 0;+ }+ li {+ margin-top: 12px;+ margin-bottom: 12px;+ display: flex;+ color: #222;+ font-size: 0.95em;+ }+`;++const PerPeriod = styled.div`+ font-weight: 500;+ margin-top: -7px;+ font-size: 0.9em;+`;++const gradient = css`+ -webkit-background-clip: text;+ -moz-background-clip: text;+ background-clip: text;+ -webkit-text-fill-color: transparent;+ -moz-text-fill-color: transparent;+ text-fill-color: transparent;+`;++const Price = styled.div`+ font-size: 60px;+ font-weight: 700;+ margin-top: -5px;+`;++const FreePrice = styled(Price)`+ background: linear-gradient(to right, #4290f5, #42e9f5);+ ${gradient};+`;++const GradientPrice = styled(Price)`+ background: linear-gradient(to right, #e01d67, #79367a);+ ${gradient};+`;++const OrangePrice = styled(Price)`+ background: linear-gradient(to right, #f5ad43, #fd764a);+ ${gradient};+`;++const Portion = styled.div`+ flex: 1;+ ${mobile`+ max-width: 500px;+ width: 100%;+ `}+`;++const TargetTitle = styled.div`+ border-bottom: 1px solid black;+ font-weight: 600;+ margin-bottom: 20px;+`;++const BulletContainer = styled.div`+ margin-right: 8px;+ display: inline-flex;+ justify-content: center;+ margin-top: 5px;+`;++const Bullet: React.FC<{ color: string }> = ({ color }) => {+ return (+ <BulletContainer>+ <Triangle size={15} opacity={1} color1={color} />+ </BulletContainer>+ );+};++export const PricingTable: React.FC<{}> = () => {+ const [period, setPeriod] = useState(Period.Monthly);+ return (+ <div>+ <PeriodSelector period={period} setPeriod={setPeriod} />+ <PricingRow>+ <Portion>+ <TargetTitle>Individuals & Small teams</TargetTitle>+ <Panel>+ <strong>Completely</strong>+ <FreePrice>Free</FreePrice>+ <PerPeriod>forever!</PerPeriod>+ <ul>+ <li>+ <Bullet color="#4290f5" />+ Unlimited usage of all Remotion tools+ </li>+ <li>+ <Bullet color="#4290f5" />+ Commercial use allowed+ </li>+ <li>+ <Bullet color="#4290f5" />+ Community support+ </li>+ </ul>+ <div style={{ flex: 1 }} />+ <BlueButton fullWidth disabled loading={false} size="bg">+ No signup required+ </BlueButton>+ </Panel>+ </Portion>+ <Spacer />+ <Spacer />+ <Spacer />+ <Portion style={{ flex: 2 }}>+ <TargetTitle>Companies</TargetTitle>+ <PricingRow>+ <Panel>+ <strong>Developer seat</strong>+ <GradientPrice>+ {period === Period.Monthly ? "$15" : "$150"}+ </GradientPrice>+ <PerPeriod>+ per {period === Period.Monthly ? "month" : "year"}+ </PerPeriod>+ <ul>+ <li>+ <Bullet color="#79367a" />+ allows 1 developer to work on Remotion projects+ </li>+ <li>+ <Bullet color="#79367a" />+ may use Remotion on multiple machines+ </li>+ <li>+ <Bullet color="#79367a" />+ Access to prioritized support+ </li>+ <li>+ <Bullet color="#79367a" />+ As long as you make renders, at least one license must be kept+ active+ </li>+ </ul>+ <div style={{ flex: 1 }} />+ <a href="https://companies.remotion.dev">+ <div>+ <BlueButton fullWidth loading={false} size="bg">+ Buy a license+ </BlueButton>+ </div>+ </a>+ </Panel>+ <Spacer />+ <Spacer />+ <Spacer />+ <Panel>+ <strong>Cloud rendering seat</strong>+ <OrangePrice>+ {period === Period.Monthly ? "$10" : "$100"}+ </OrangePrice>+ <PerPeriod>+ per {period === Period.Monthly ? "month" : "year"}+ </PerPeriod>+ <ul>+ <li>+ <Bullet color="#f5ad43" />+ Choose 1 seat per cloud instance (e.g. VPS, EC2) you are+ running Remotion on+ </li>+ <li>+ <Bullet color="#f5ad43" />+ Pay only for as long as you are rendering videos.+ </li>+ <li>+ <Bullet color="#f5ad43" />+ Using serverless? Choose 1 seat per 2.000 renders per month.+ </li>+ </ul>+ <div style={{ flex: 1 }} />+ <a href="https://companies.remotion.dev">+ <div>+ <BlueButton fullWidth loading={false} size="bg">+ Buy a license+ </BlueButton>+ </div>+ </a>+ </Panel>+ </PricingRow>+ </Portion>+ </PricingRow>+ </div>+ );+};diff --git a/packages/docs/components/LandingPage/parametrize.tsx b/packages/docs/components/LandingPage/parametrize.tsxindex 992461d245..e3fc9a479d 100644--- a/packages/docs/components/LandingPage/parametrize.tsx+++ b/packages/docs/components/LandingPage/parametrize.tsx@@ -144,23 +144,32 @@ export const Parametrize: React.FC = () => {</span><div style={{ height: 10 }}></div><div>- <Input- autoFocus- ref={ref}- type="text"- placeholder="Your Github username"- ></Input>{" "}- <div style={{ width: 8, display: "inline-block" }}></div>- <SubmitButton- disabled={state.type === "loading"}- style={{ opacity: state.type === "loading" ? 0.5 : 1 }}- onClick={() => setUsername(ref.current?.value as string)}+ <form+ onSubmit={(e) => {+ e.preventDefault();+ setUsername(ref.current?.value as string);+ }}>- Show video- </SubmitButton>+ <Input+ autoFocus+ ref={ref}+ type="text"+ placeholder="Your Github username"+ ></Input>{" "}+ <div style={{ width: 8, display: "inline-block" }}></div>+ <SubmitButton+ disabled={state.type === "loading"}+ style={{ opacity: state.type === "loading" ? 0.5 : 1 }}+ onClick={() => setUsername(ref.current?.value as string)}+ >+ Show video+ </SubmitButton>+ </form></div>{state.type === "error" ? (- <div style={{ color: "red" }}>{state.type}</div>+ <div style={{ color: "red", fontSize: 13 }}>+ Error: {state.error.message}+ </div>) : null}</div><ProgrammaticContentdiff --git a/packages/docs/components/PeriodSelector.tsx b/packages/docs/components/PeriodSelector.tsxnew file mode 100644index 0000000000..229f60c885--- /dev/null+++ b/packages/docs/components/PeriodSelector.tsx@@ -0,0 +1,42 @@+import React from "react";+import styled from "styled-components";+import { BlueButton, ClearButton } from "./layout/Button";++enum Period {+ Monthly = "monthly",+ Yearly = "yearly",+}+const PeriodSwitcher = styled.div`+ display: flex;+ justify-content: center;+ margin-bottom: 30px;+`;++export const PeriodSelector: React.FC<{+ period: Period;+ setPeriod: (per: Period) => void;+}> = ({ period, setPeriod }) => {+ const MonthlyComponent = period === Period.Monthly ? BlueButton : ClearButton;+ const YearlyComponent = period !== Period.Monthly ? BlueButton : ClearButton;++ return (+ <PeriodSwitcher>+ <MonthlyComponent+ loading={false}+ size="sm"+ fullWidth={false}+ onClick={() => setPeriod(Period.Monthly)}+ >+ Monthly+ </MonthlyComponent>+ <YearlyComponent+ loading={false}+ size="sm"+ fullWidth={false}+ onClick={() => setPeriod(Period.Yearly)}+ >+ Yearly+ </YearlyComponent>+ </PeriodSwitcher>+ );+};diff --git a/packages/docs/components/Triangle.tsx b/packages/docs/components/Triangle.tsxnew file mode 100644index 0000000000..4b8032b486--- /dev/null+++ b/packages/docs/components/Triangle.tsx@@ -0,0 +1,28 @@+import React from "react";+import styled from "styled-components";++const Container = styled.svg`+ transform: rotate(90deg);+`;++export const Triangle: React.FC<{+ size: number;+ opacity: number;+ color1?: string;+}> = ({ size, opacity, color1 = "#42e9f5" }) => {+ return (+ <Container+ width={size}+ height={size}+ style={{ opacity }}+ viewBox="-100 -100 400 400"+ >+ <g stroke={color1} strokeWidth="100" strokeLinejoin="round">+ <path+ fill={color1}+ d="M 2 172 a 196 100 0 0 0 195 5 A 196 240 0 0 0 100 2.259 A 196 240 0 0 0 2 172 z"+ />+ </g>+ </Container>+ );+};diff --git a/packages/docs/components/layout/Button.tsx b/packages/docs/components/layout/Button.tsxnew file mode 100644index 0000000000..5808329593--- /dev/null+++ b/packages/docs/components/layout/Button.tsx@@ -0,0 +1,86 @@+import { opacify } from "polished";+import React, { ComponentProps } from "react";+import styled from "styled-components";+import { ButtonSpinner } from "./ButtonSpinner";+import { BLUE_TEXT, RED, UNDERLAY_BLUE, UNDERLAY_RED } from "./colors";++type ExtraProps = {+ size: Size;+ fullWidth: boolean;+ background: string;+ hoverColor: string;+ color: string;+ loading: boolean;+};++const Container = styled.button<ExtraProps>`+ padding: ${(props) => (props.size === "sm" ? "10px 16px" : "16px 22px")};+ border-radius: 8px;+ font-weight: bold;+ background-color: ${(props) => props.background};+ color: ${(props) => props.color};+ cursor: ${(props) => (props.disabled ? "default" : "pointer")};+ appearance: none;+ border: none;+ font: inherit;+ font-weight: bold;+ display: flex;+ flex-direction: row;+ align-items: center;+ justify-content: center;+ transition: background-color 0.1s;+ ${(props) => (props.fullWidth ? "width: 100%;" : "")};+ opacity: ${(props) => (props.disabled ? 0.7 : 1)};+ &:not([disabled]):hover {+ background-color: ${(props) => props.hoverColor};+ }+`;++type Size = "sm" | "bg";++type Props = ComponentProps<typeof Container> & ExtraProps;+type MandatoryProps = Omit<ExtraProps, "background" | "color" | "hoverColor">;+type PrestyledProps = ComponentProps<typeof Container> & MandatoryProps;++export const Button: React.FC<Props> = (props) => {+ const { children, loading, ...other } = props;+ const actualDisabled = other.disabled || loading;+ return (+ <Container {...other} disabled={actualDisabled}>+ {children} {loading ? <ButtonSpinner /> : null}+ </Container>+ );+};++export const BlueButton: React.FC<PrestyledProps> = (props) => {+ return (+ <Button+ {...props}+ background={UNDERLAY_BLUE}+ hoverColor={opacify(0.1, UNDERLAY_BLUE)}+ color={BLUE_TEXT}+ />+ );+};++export const RedButton: React.FC<PrestyledProps> = (props) => {+ return (+ <Button+ {...props}+ background={UNDERLAY_RED}+ hoverColor={opacify(0.1, UNDERLAY_RED)}+ color={RED}+ />+ );+};++export const ClearButton: React.FC<PrestyledProps> = (props) => {+ return (+ <Button+ {...props}+ background="transparent"+ color="black"+ hoverColor="rgba(0, 0, 0, 0.04)"+ />+ );+};diff --git a/packages/docs/components/layout/ButtonSpinner.tsx b/packages/docs/components/layout/ButtonSpinner.tsxnew file mode 100644index 0000000000..6c9bf52d2b--- /dev/null+++ b/packages/docs/components/layout/ButtonSpinner.tsx@@ -0,0 +1,45 @@+import styled, { keyframes } from "styled-components";++const radius = 10;+const strokeWidth = 2.5;+const actualR = radius - strokeWidth;++export const Container = styled.div`+ width: ${radius * 2}px;+ height: ${radius * 2}px;+ border-radius: ${radius}px;+ margin-left: 10px;+`;++const circumference = 2 * actualR * Math.PI;+const anim = keyframes`+ from {+ stroke-dashoffset: 0+ }+ to {+ stroke-dashoffset: ${circumference}+ }+`;++const Circle = styled.circle`+ animation: ${anim} 2s infinite linear;+`;++export const ButtonSpinner: React.FC = () => {+ return (+ <Container>+ <svg viewBox="0 0 20 20">+ <Circle+ r={actualR}+ cx={radius}+ cy={radius}+ stroke="currentColor"+ strokeDasharray={`${circumference / 2}`}+ strokeLinecap="round"+ strokeWidth={strokeWidth}+ fill="transparent"+ />+ </svg>+ </Container>+ );+};diff --git a/packages/docs/components/layout/Spacer.tsx b/packages/docs/components/layout/Spacer.tsxnew file mode 100644index 0000000000..366557c9f3--- /dev/null+++ b/packages/docs/components/layout/Spacer.tsx@@ -0,0 +1,6 @@+import styled from "styled-components";++export const Spacer = styled.div`+ height: 4px;+ width: 4px;+`;diff --git a/packages/docs/components/layout/colors.ts b/packages/docs/components/layout/colors.tsnew file mode 100644index 0000000000..e7f875596d--- /dev/null+++ b/packages/docs/components/layout/colors.ts@@ -0,0 +1,8 @@+import { darken, transparentize } from "polished";++export const LIGHT_BLUE = "#42e9f5";+export const DARK_BLUE = "#4290f5";+export const UNDERLAY_BLUE = transparentize(0.85, DARK_BLUE);+export const RED = "#e74c3c";+export const UNDERLAY_RED = transparentize(0.9, RED);+export const BLUE_TEXT = darken(0.3, DARK_BLUE);diff --git a/packages/docs/components/layout/layout.ts b/packages/docs/components/layout/layout.tsnew file mode 100644index 0000000000..32080c3802--- /dev/null+++ b/packages/docs/components/layout/layout.ts@@ -0,0 +1,9 @@+import { css } from "styled-components";++export const BREAKPOINT_WIDTH = 900;++export const mobile = (arg0: any, ...args: any[]) => css`+ @media (max-width: ${BREAKPOINT_WIDTH}px) {+ ${css(arg0, ...args)};+ }+`;