Skip to content

🎥 Make videos programmatically with React

refactor to css modules

Jonny Burgeraf3e23d78efe
diff --git a/packages/docs/components/LandingPage/CodeExample.tsx b/packages/docs/components/LandingPage/CodeExample.tsx
index 6c0e00425e..a39ba7d31b 100644
--- a/packages/docs/components/LandingPage/CodeExample.tsx
+++ b/packages/docs/components/LandingPage/CodeExample.tsx
@@ -1,7 +1,6 @@
import { Player } from "@remotion/player";
import React, { useState } from "react";
import { interpolate, useCurrentFrame } from "remotion";
-import styled from "styled-components";
const IMG_WIDTH = 1120;
const IMG_HEIGHT = 760;
@@ -48,17 +47,14 @@ const Preview: React.FC = () => {
);
};
-const Tab = styled.button<{
- active: boolean;
-}>`
- appearance: none;
- background-color: transparent;
- font-family: inherit;
- border: none;
- cursor: pointer;
- color: var(--text-color);
- opacity: ${(props) => (props.active ? 1 : 0.5)};
-`;
+const tabStyle = {
+ appearance: "none",
+ backgroundColor: "transparent",
+ fontFamily: "inherit",
+ border: "none",
+ cursor: "pointer",
+ color: "var(--text-color)",
+} as const;
type Tab = "code" | "preview";
@@ -66,13 +62,19 @@ export const CodeExample: React.FC = () => {
const [tab, setTab] = useState<Tab>("code");
return (
<div style={{ flex: 1, textAlign: "left", width: 500 }}>
- <Tab active={tab === "code"} onClick={() => setTab("code")}>
+ <button
+ style={{ ...tabStyle, opacity: tab === "code" ? 1 : 0.5 }}
+ onClick={() => setTab("code")}
+ >
Code
- </Tab>
+ </button>
|
- <Tab active={tab === "preview"} onClick={() => setTab("preview")}>
+ <button
+ style={{ ...tabStyle, opacity: tab === "preview" ? 1 : 0.5 }}
+ onClick={() => setTab("preview")}
+ >
Preview
- </Tab>
+ </button>
<div>
{tab === "code" && (
<div style={container}>
diff --git a/packages/docs/components/LandingPage/FreePricing.tsx b/packages/docs/components/LandingPage/FreePricing.tsx
index 9c5e5d0c26..f7d7f200a4 100644
--- a/packages/docs/components/LandingPage/FreePricing.tsx
+++ b/packages/docs/components/LandingPage/FreePricing.tsx
@@ -1,49 +1,22 @@
import React from "react";
-import styled from "styled-components";
-import { mobile } from "../layout/layout";
+import styles from "./pricing.module.css";
import { PricingTable } from "./PricingTable";
-const Row = styled.div`
- display: flex;
- flex-direction: row;
- text-align: center;
-`;
-
-const Title = styled.h2`
- font-size: 2.5em;
- font-weight: 700;
- font-family: --apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
- Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
- line-height: 1.1;
-`;
-
-const Mp4 = styled.span`
- background: linear-gradient(to right, rgb(66, 144, 245), rgb(66, 233, 245));
- -webkit-text-fill-color: transparent;
- -webkit-background-clip: text;
-`;
-
-const Container = styled.div`
- text-align: center;
- ${mobile`
- text-align: left;
- `}
-`;
-
export const FreePricing: React.FC = () => {
return (
<>
- <Container>
- <Title>
- <Mp4>Free</Mp4> for individuals <br /> Funded by companies
- </Title>
+ <div className={styles.container}>
+ <h2 className={styles.title}>
+ <span className={styles.mp4}>Free</span> for individuals <br /> Funded
+ by companies
+ </h2>
<p>
Remotion is free for individuals - you can even build a business on
it! <br />
As a company, you need a license to use Remotion. <br /> With your
support, we constantly improve Remotion for everyone.
</p>
- </Container>
+ </div>
<PricingTable></PricingTable>
<br />
<br />
diff --git a/packages/docs/components/LandingPage/GetStartedStrip.tsx b/packages/docs/components/LandingPage/GetStartedStrip.tsx
index e68a946bd7..a483c60055 100644
--- a/packages/docs/components/LandingPage/GetStartedStrip.tsx
+++ b/packages/docs/components/LandingPage/GetStartedStrip.tsx
@@ -1,72 +1,21 @@
import React, { useState } from "react";
-import styled, { keyframes } from "styled-components";
import { BlueButton } from "../layout/Button";
+import styles from "./get-started.module.css";
import { GithubButton } from "./GithubButton";
-const Row = styled.div`
- display: flex;
- flex-direction: row;
- align-items: center;
-`;
-
-const CodeBlock = styled.div`
- background-color: #333;
- padding: 12px 16px;
- border-radius: 8px;
- color: white;
- font: var(--ifm-code-font-size) / var(--ifm-pre-line-height)
- var(--ifm-font-family-monospace);
- cursor: pointer;
- &:hover {
- background-color: #444;
- }
-`;
-
-const A = styled.a`
- &:hover {
- text-decoration: none;
- }
-`;
-
-const animation = keyframes`
- 0% {
- transform: translateY(-18px);
- opacity: 0;
- }
-
- 30% {
- opacity: 0.7;
- }
- 70% {
- opacity: 0.7;
- }
- 100% {
- transform: translateY(-23px);
- opacity: 0;
- }
-`;
-
-const Copied = styled.div`
- position: absolute;
- animation: ${animation} 0.7s linear;
- z-index: 0;
- animation-fill-mode: forwards;
- top: 0;
- font: var(--ifm-code-font-size) / var(--ifm-pre-line-height)
- var(--ifm-font-family-monospace);
- font-size: 13px;
- width: 100%;
- text-align: center;
-`;
-
export const GetStarted: React.FC = () => {
const [clicked, setClicked] = useState<number | null>(null);
return (
<>
- <Row>
+ <div className={styles.myrow}>
<div style={{ position: "relative" }}>
- {clicked ? <Copied key={clicked}>Copied!</Copied> : null}
- <CodeBlock
+ {clicked ? (
+ <div className={styles.copied} key={clicked}>
+ Copied!
+ </div>
+ ) : null}
+ <div
+ className={styles.codeblock}
onClick={() => {
navigator.clipboard.writeText("npm init video");
@@ -75,23 +24,22 @@ export const GetStarted: React.FC = () => {
title="Click to copy"
>
$ npm init video
- </CodeBlock>
+ </div>
</div>
<div style={{ width: 10 }}></div>
- <A href="/docs">
+ <a className={styles.a} href="/docs">
<BlueButton size="sm" loading={false} fullWidth={false}>
Docs
</BlueButton>
- </A>
+ </a>
<div style={{ width: 10 }}></div>
- <A href="https://github.com/JonnyBurger/remotion">
+ <a className={styles.a} href="https://github.com/JonnyBurger/remotion">
<BlueButton size="sm" loading={false} fullWidth={false}>
<GithubButton></GithubButton>
</BlueButton>
- </A>
- </Row>
+ </a>
+ </div>
<div style={{ height: 10 }}></div>
- <Row></Row>
</>
);
};
diff --git a/packages/docs/components/LandingPage/GithubButton.tsx b/packages/docs/components/LandingPage/GithubButton.tsx
index ab120f0468..b2fe84684c 100644
--- a/packages/docs/components/LandingPage/GithubButton.tsx
+++ b/packages/docs/components/LandingPage/GithubButton.tsx
@@ -1,18 +1,5 @@
import React, { useEffect, useState } from "react";
-import styled from "styled-components";
-
-const Container = styled.div`
- display: flex;
- flex-direction: row;
- font-weight: bold;
- justify-content: center;
- align-items: center;
-`;
-
-const Stars = styled.div`
- font-size: 0.75em;
- margin-top: 2.5px;
-`;
+import styles from "./github.module.css";
const GithubIcon: React.FC = () => {
return (
@@ -42,9 +29,10 @@ export const GithubButton: React.FC = () => {
}, []);
return (
- <Container>
+ <div className={styles.container}>
<GithubIcon></GithubIcon> <div>Github</div>{" "}
- <div style={{ width: 8 }}></div> <Stars>{stars ? stars : null}</Stars>
- </Container>
+ <div style={{ width: 8 }}></div>{" "}
+ <div className={styles.stars}>{stars ? stars : null}</div>
+ </div>
);
};
diff --git a/packages/docs/components/LandingPage/GithubDemo.tsx b/packages/docs/components/LandingPage/GithubDemo.tsx
index 68cb379bd0..a226a8c7b6 100644
--- a/packages/docs/components/LandingPage/GithubDemo.tsx
+++ b/packages/docs/components/LandingPage/GithubDemo.tsx
@@ -8,28 +8,7 @@ import {
useCurrentFrame,
useVideoConfig,
} from "remotion";
-import styled from "styled-components";
-
-const Title = styled.h1`
- font-size: 5em;
- color: var(--text-color);
- margin-bottom: 0;
- margin-top: 0;
- line-height: 1.4;
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
- Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
-`;
-
-const Description = styled.p`
- font-size: 3em;
- margin-bottom: 0;
- margin-top: 0;
- line-height: 1.4;
- color: var(--text-color);
-
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
- Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
-`;
+import styles from "./githubdemo.module.css";
export type GithubResponse = {
login: string;
@@ -84,12 +63,18 @@ export const GithubDemo: React.FC<{
/>
<div style={{ width: 60 }} />
<div>
- <Title style={{ transform: `translateY(${titleTranslation}px)` }}>
+ <h1
+ className={styles.githubdemotitle}
+ style={{ transform: `translateY(${titleTranslation}px)` }}
+ >
Hi {data.login}!
- </Title>
- <Description style={{ opacity: subtitleOpacity }}>
+ </h1>
+ <p
+ className={styles.githubdemodescription}
+ style={{ opacity: subtitleOpacity }}
+ >
You have {data.followers} followers.
- </Description>
+ </p>
</div>
</div>
</AbsoluteFill>
diff --git a/packages/docs/components/LandingPage/editor.module.css b/packages/docs/components/LandingPage/editor.module.css
new file mode 100644
index 0000000000..651cb0ecb3
--- /dev/null
+++ b/packages/docs/components/LandingPage/editor.module.css
@@ -0,0 +1,47 @@
+.row {
+ display: flex;
+ flex-direction: row;
+ justify-content: flex-end;
+ text-align: right;
+ align-items: center;
+}
+
+.title {
+ font-size: 2.5em;
+ font-weight: 700;
+ font-family: --apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
+ Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
+ line-height: 1.1;
+ text-align: right;
+}
+
+.mp4 {
+ background: linear-gradient(to right, rgb(66, 144, 245), rgb(66, 233, 245));
+ -webkit-text-fill-color: transparent;
+ -webkit-background-clip: text;
+}
+
+@keyframes opacity {
+ from {
+ opacity: 0;
+ }
+ to {
+ opacity: 1;
+ }
+}
+
+.video {
+ animation: opacity 0.6s;
+}
+
+@media (max-width: 900px) {
+ .row {
+ flex-direction: column-reverse;
+ text-align: left;
+ align-items: flex-start;
+ justify-content: flex-start;
+ }
+ .title {
+ text-align: left;
+ }
+}
diff --git a/packages/docs/components/LandingPage/editor.tsx b/packages/docs/components/LandingPage/editor.tsx
index aa0e1c732c..69550925c5 100644
--- a/packages/docs/components/LandingPage/editor.tsx
+++ b/packages/docs/components/LandingPage/editor.tsx
@@ -1,53 +1,5 @@
import React, { useCallback, useEffect, useRef, useState } from "react";
-import styled, { keyframes } from "styled-components";
-import { mobile } from "../layout/layout";
-
-const Row = styled.div`
- display: flex;
- flex-direction: row;
- justify-content: flex-end;
- text-align: right;
- align-items: center;
- ${mobile`
- flex-direction: column-reverse;
- text-align: left;
- align-items: flex-start;
- justify-content: flex-start;
- `}
-`;
-
-const Title = styled.h2`
- font-size: 2.5em;
- font-weight: 700;
- font-family: --apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
- Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
- line-height: 1.1;
- text-align: right;
- ${mobile`
- text-align: left;
- `}
-`;
-
-const Mp4 = styled.span`
- background: linear-gradient(to right, rgb(66, 144, 245), rgb(66, 233, 245));
- -webkit-text-fill-color: transparent;
- -webkit-background-clip: text;
-`;
-
-const animation = keyframes`
- from {
- opacity: 0;
- }
- to {
- opacity: 1;
- }
-`;
-const Video = styled.video<{
- playing: boolean;
-}>`
- animation: ${animation} 0.6s;
- animation-play-state: ${(props) => (props.playing ? "running" : "paused")};
-`;
+import styles from "./editor.module.css";
export const LightningFastEditor: React.FC = () => {
const ref = useRef<HTMLDivElement>(null);
@@ -78,28 +30,33 @@ export const LightningFastEditor: React.FC = () => {
return () => observer.unobserve(current);
}, []);
return (
- <Row ref={ref}>
+ <div className={styles.row} ref={ref}>
<div>
- <Video
+ <video
src="/img/player-demo.mp4"
autoPlay
+ className={styles.video}
muted
playsInline
- playing={isIntersecting}
loop
- style={{ width: 500, borderRadius: 7, overflow: "hidden" }}
- ></Video>
+ style={{
+ animationPlayState: isIntersecting ? "running" : "paused",
+ width: 500,
+ borderRadius: 7,
+ overflow: "hidden",
+ }}
+ ></video>
</div>
<div style={{ flex: 1 }}>
- <Title>
- Fast and <br /> <Mp4>delightful</Mp4> editing
- </Title>
+ <h2 className={styles.title}>
+ Fast and <br /> <span className={styles.mp4}>delightful</span> editing
+ </h2>
<p>
Preview your video in the browser. <br />
Fast refresh while the video is playing. <br />
Scrub through the timeline to get every frame perfect.
</p>
</div>
- </Row>
+ </div>
);
};
diff --git a/packages/docs/components/LandingPage/get-started.module.css b/packages/docs/components/LandingPage/get-started.module.css
new file mode 100644
index 0000000000..d1d51cfad1
--- /dev/null
+++ b/packages/docs/components/LandingPage/get-started.module.css
@@ -0,0 +1,54 @@
+.myrow {
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+}
+
+.codeblock {
+ background-color: #333;
+ padding: 12px 16px;
+ border-radius: 8px;
+ color: white;
+ font: var(--ifm-code-font-size) / var(--ifm-pre-line-height)
+ var(--ifm-font-family-monospace);
+ cursor: pointer;
+}
+
+.codeblock:hover {
+ background-color: #444;
+}
+
+@keyframes click {
+ 0% {
+ transform: translateY(-18px);
+ opacity: 0;
+ }
+
+ 30% {
+ opacity: 0.7;
+ }
+ 70% {
+ opacity: 0.7;
+ }
+ 100% {
+ transform: translateY(-23px);
+ opacity: 0;
+ }
+}
+
+.a:hover {
+ text-decoration: none;
+}
+
+.copied {
+ position: absolute;
+ animation: click 0.7s linear;
+ z-index: 0;
+ animation-fill-mode: forwards;
+ top: 0;
+ font: var(--ifm-code-font-size) / var(--ifm-pre-line-height)
+ var(--ifm-font-family-monospace);
+ font-size: 13px;
+ width: 100%;
+ text-align: center;
+}
diff --git a/packages/docs/components/LandingPage/github.module.css b/packages/docs/components/LandingPage/github.module.css
new file mode 100644
index 0000000000..c5dc8d6c8a
--- /dev/null
+++ b/packages/docs/components/LandingPage/github.module.css
@@ -0,0 +1,12 @@
+.container {
+ display: flex;
+ flex-direction: row;
+ font-weight: bold;
+ justify-content: center;
+ align-items: center;
+}
+
+.stars {
+ font-size: 0.75em;
+ margin-top: 2.5px;
+}
diff --git a/packages/docs/components/LandingPage/githubdemo.module.css b/packages/docs/components/LandingPage/githubdemo.module.css
new file mode 100644
index 0000000000..93bcfa2c28
--- /dev/null
+++ b/packages/docs/components/LandingPage/githubdemo.module.css
@@ -0,0 +1,20 @@
+.githubdemotitle {
+ font-size: 5em;
+ color: var(--text-color);
+ margin-bottom: 0;
+ margin-top: 0;
+ line-height: 1.4;
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
+ Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
+}
+
+.githubdemodescription {
+ font-size: 3em;
+ margin-bottom: 0;
+ margin-top: 0;
+ line-height: 1.4;
+ color: var(--text-color);
+
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
+ Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
+}
diff --git a/packages/docs/components/LandingPage/if-you-know-react.tsx b/packages/docs/components/LandingPage/if-you-know-react.tsx
index ade4e917a9..e82781426a 100644
--- a/packages/docs/components/LandingPage/if-you-know-react.tsx
+++ b/packages/docs/components/LandingPage/if-you-know-react.tsx
@@ -1,77 +1,32 @@
import React from "react";
-import styled from "styled-components";
import { BlueButton } from "../layout/Button";
-import { mobile } from "../layout/layout";
import { Spacer } from "../layout/Spacer";
import { CodeExample } from "./CodeExample";
-
-const Row = styled.div`
- display: flex;
- flex-direction: row;
- text-align: right;
- justify-content: flex-end;
- align-items: center;
- ${mobile`
- flex-direction: column-reverse;
- text-align: left;
- justify-content: flex-start;
- align-items: flex-start;
- `}
-`;
-
-const Title = styled.h2`
- font-size: 2.5em;
- font-weight: 700;
- font-family: --apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
- Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
- line-height: 1.1;
- text-align: right;
- ${mobile`
- text-align: left;
- `}
-`;
-
-const Rea = styled.span`
- background: linear-gradient(to right, rgb(66, 144, 245), rgb(66, 233, 245));
- -webkit-text-fill-color: transparent;
- -webkit-background-clip: text;
-`;
-
-const A = styled.a`
- display: inline-block;
- ${mobile`
-
- margin-bottom: 80px;
- `};
- &:hover  {
- text-decoration: none;
- }
-`;
+import styles from "./ifyouknowreact.module.css";
export const IfYouKnowReact: React.FC = () => {
return (
- <Row>
+ <div className={styles.ifyouknowrow}>
<CodeExample></CodeExample>
<div style={{ width: 40 }}></div>
<div>
- <Title>
- If you know <Rea>React</Rea> <br />
+ <h2 className={styles.ifyouknowtitle}>
+ If you know <span className={styles.rea}>React</span> <br />
you can make videos.
- </Title>
+ </h2>
<p>
Remotion gives you the tools for video creation, <br /> but the rules
of React stay the same. <br />
- <br />
- Learn the fundamentals in just a few minutes.
- <Spacer></Spacer>
- <Spacer></Spacer>
- <A href="/docs/the-fundamentals">
- <BlueButton size="sm" fullWidth={false} loading={false}>
- Learn Remotion
- </BlueButton>
- </A>
</p>
+ Learn the fundamentals in just a few minutes.
+ <Spacer></Spacer>
+ <Spacer></Spacer>
+ <a className={styles.a} href="/docs/the-fundamentals">
+ <BlueButton size="sm" fullWidth={false} loading={false}>
+ Learn Remotion
+ </BlueButton>
+ </a>
</div>
- </Row>
+ </div>
);
};
diff --git a/packages/docs/components/LandingPage/ifyouknowreact.module.css b/packages/docs/components/LandingPage/ifyouknowreact.module.css
new file mode 100644
index 0000000000..408a6bdb68
--- /dev/null
+++ b/packages/docs/components/LandingPage/ifyouknowreact.module.css
@@ -0,0 +1,45 @@
+.ifyouknowrow {
+ display: flex;
+ flex-direction: row;
+ text-align: right;
+ justify-content: flex-end;
+ align-items: center;
+}
+
+.ifyouknowtitle {
+ font-size: 2.5em;
+ font-weight: 700;
+ font-family: --apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
+ Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
+ line-height: 1.1;
+ text-align: right;
+}
+
+.rea {
+ background: linear-gradient(to right, rgb(66, 144, 245), rgb(66, 233, 245));
+ -webkit-text-fill-color: transparent;
+ -webkit-background-clip: text;
+}
+
+.a {
+ display: inline-block;
+}
+
+.a:hover  {
+ text-decoration: none;
+}
+
+@media screen and (max-width: 900px) {
+ .ifyouknowrow {
+ flex-direction: column-reverse;
+ text-align: left;
+ justify-content: flex-start;
+ align-items: flex-start;
+ }
+ .ifyouknowtitle {
+ text-align: left;
+ }
+ .a {
+ margin-bottom: 80px;
+ }
+}
diff --git a/packages/docs/components/LandingPage/pricing.module.css b/packages/docs/components/LandingPage/pricing.module.css
new file mode 100644
index 0000000000..7fdfed1329
--- /dev/null
+++ b/packages/docs/components/LandingPage/pricing.module.css
@@ -0,0 +1,23 @@
+.title {
+ font-size: 2.5em;
+ font-weight: 700;
+ font-family: --apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
+ Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
+ line-height: 1.1;
+}
+
+.mp4 {
+ background: linear-gradient(to right, rgb(66, 144, 245), rgb(66, 233, 245));
+ -webkit-text-fill-color: transparent;
+ -webkit-background-clip: text;
+}
+
+.container {
+ text-align: center;
+}
+
+@media screen and (max-width: 900px) {
+ .container {
+ text-align: left;
+ }
+}
diff --git a/packages/docs/components/PeriodSelector.tsx b/packages/docs/components/PeriodSelector.tsx
index 229f60c885..fb3f5bca62 100644
--- a/packages/docs/components/PeriodSelector.tsx
+++ b/packages/docs/components/PeriodSelector.tsx
@@ -1,16 +1,10 @@
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;
@@ -20,7 +14,9 @@ export const PeriodSelector: React.FC<{
const YearlyComponent = period !== Period.Monthly ? BlueButton : ClearButton;
return (
- <PeriodSwitcher>
+ <div
+ style={{ display: "flex", justifyContent: "center", marginBottom: 30 }}
+ >
<MonthlyComponent
loading={false}
size="sm"
@@ -37,6 +33,6 @@ export const PeriodSelector: React.FC<{
>
Yearly
</YearlyComponent>
- </PeriodSwitcher>
+ </div>
);
};
diff --git a/packages/docs/components/Triangle.tsx b/packages/docs/components/Triangle.tsx
index 4b8032b486..d049fd10db 100644
--- a/packages/docs/components/Triangle.tsx
+++ b/packages/docs/components/Triangle.tsx
@@ -1,9 +1,4 @@
import React from "react";
-import styled from "styled-components";
-
-const Container = styled.svg`
- transform: rotate(90deg);
-`;
export const Triangle: React.FC<{
size: number;
@@ -11,10 +6,10 @@ export const Triangle: React.FC<{
color1?: string;
}> = ({ size, opacity, color1 = "#42e9f5" }) => {
return (
- <Container
+ <svg
width={size}
height={size}
- style={{ opacity }}
+ style={{ opacity, transform: `rotate(90deg)` }}
viewBox="-100 -100 400 400"
>
<g stroke={color1} strokeWidth="100" strokeLinejoin="round">
@@ -23,6 +18,6 @@ export const Triangle: React.FC<{
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>
+ </svg>
);
};
diff --git a/packages/docs/components/layout/Button.tsx b/packages/docs/components/layout/Button.tsx
index f122c40445..e76f0f808d 100644
--- a/packages/docs/components/layout/Button.tsx
+++ b/packages/docs/components/layout/Button.tsx
@@ -1,7 +1,6 @@
import { opacify } from "polished";
import React, { ComponentProps } from "react";
import styled from "styled-components";
-import { ButtonSpinner } from "./ButtonSpinner";
import { RED, UNDERLAY_RED } from "./colors";
type ExtraProps = {
@@ -47,7 +46,7 @@ export const Button: React.FC<Props> = (props) => {
const actualDisabled = other.disabled || loading;
return (
<Container {...other} disabled={actualDisabled}>
- {children} {loading ? <ButtonSpinner /> : null}
+ {children}
</Container>
);
};
diff --git a/packages/docs/components/layout/ButtonSpinner.tsx b/packages/docs/components/layout/ButtonSpinner.tsx
deleted file mode 100644
index 9e0dd26960..0000000000
--- a/packages/docs/components/layout/ButtonSpinner.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-import React from "react";
-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.tsx
index 366557c9f3..5fdc03b74c 100644
--- a/packages/docs/components/layout/Spacer.tsx
+++ b/packages/docs/components/layout/Spacer.tsx
@@ -1,6 +1,5 @@
-import styled from "styled-components";
+import React from "react";
-export const Spacer = styled.div`
- height: 4px;
- width: 4px;
-`;
+export const Spacer: React.FC = () => {
+ return <div style={{ width: 4, height: 4 }}></div>;
+};
diff --git a/packages/docs/src/pages/index.tsx b/packages/docs/src/pages/index.tsx
index 5605b2dc63..e2579ce7ac 100644
--- a/packages/docs/src/pages/index.tsx
+++ b/packages/docs/src/pages/index.tsx
@@ -1,37 +1,25 @@
import splitbee from "@splitbee/web";
import Layout from "@theme/Layout";
import React from "react";
-import styled from "styled-components";
import { LightningFastEditor } from "../../components/LandingPage/editor";
import { FreePricing } from "../../components/LandingPage/FreePricing";
import { IfYouKnowReact } from "../../components/LandingPage/if-you-know-react";
import { Parametrize } from "../../components/LandingPage/parametrize";
import { RealMP4Videos } from "../../components/LandingPage/real-mp4-videos";
import { WriteInReact } from "../../components/LandingPage/WriteInReact";
-import { mobile } from "../../components/layout/layout";
+import styles from "./landing.module.css";
setTimeout(() => {
splitbee.init();
}, 100);
-const Content = styled.div`
- max-width: 1000px;
- margin: auto;
- padding-top: 10vh;
- padding-left: 20px;
- padding-right: 20px;
- ${mobile`
- max-width: 500px;
- `}
-`;
-
const NewLanding: React.FC = () => {
return (
<Layout
title="Write videos in React"
description="Create MP4 motion graphics in React. Leverage CSS, SVG, WebGL and more technologies to render videos programmatically!"
>
- <Content>
+ <div className={styles.content}>
<WriteInReact></WriteInReact>
<br />
<br />
@@ -60,7 +48,7 @@ const NewLanding: React.FC = () => {
<br />
<br />
<FreePricing></FreePricing>
- </Content>
+ </div>
</Layout>
);
};
diff --git a/packages/docs/src/pages/landing.module.css b/packages/docs/src/pages/landing.module.css
new file mode 100644
index 0000000000..25fbd63d56
--- /dev/null
+++ b/packages/docs/src/pages/landing.module.css
@@ -0,0 +1,12 @@
+.content {
+ max-width: 1000px;
+ margin: auto;
+ padding-top: 10vh;
+ padding-left: 20px;
+ padding-right: 20px;
+}
+@media (max-width: 900px) {
+ .content {
+ max-width: 500px;
+ }
+}