Skip to content

πŸŽ₯ Make videos programmatically with React

US

Jonny Burger5fbfc5733f0d
diff --git a/packages/docs/src/remotion/HomepageVideo/Card.tsx b/packages/docs/src/remotion/HomepageVideo/Card.tsx
index 7839a3739b..04846c66ef 100644
--- a/packages/docs/src/remotion/HomepageVideo/Card.tsx
+++ b/packages/docs/src/remotion/HomepageVideo/Card.tsx
@@ -283,8 +283,7 @@ const Card: React.FC<{
}}
className={styles.content}
>
- <CurrentCountry />
- {content}
+ {content}{" "}
</AbsoluteFill>
</div>
);
@@ -306,6 +305,17 @@ export const Cards: React.FC<{
return (
<AbsoluteFill>
{new Array(4).fill(true).map((_, i) => {
+ const index = indices[i];
+ const content =
+ index === 0 ? (
+ <CurrentCountry />
+ ) : index === 1 ? (
+ "🐱"
+ ) : i === 2 ? (
+ "🐭"
+ ) : (
+ "🐹"
+ );
return (
<Card
// eslint-disable-next-line react/no-array-index-key
@@ -313,7 +323,7 @@ export const Cards: React.FC<{
onUpdate={onUpdate}
refsToUse={refs}
index={i}
- content={indices[i]}
+ content={content}
positions={positions}
shouldBePositions={shouldBePositions}
indices={indices}
diff --git a/packages/docs/src/remotion/HomepageVideo/CurrentCountry.tsx b/packages/docs/src/remotion/HomepageVideo/CurrentCountry.tsx
index f084751eae..b0cf650ed7 100644
--- a/packages/docs/src/remotion/HomepageVideo/CurrentCountry.tsx
+++ b/packages/docs/src/remotion/HomepageVideo/CurrentCountry.tsx
@@ -1,26 +1,37 @@
import { getBoundingBox, resetPath } from "@remotion/paths";
import React from "react";
import { AbsoluteFill } from "remotion";
-import { countriesPaths } from "./paths";
+import { countriesPaths, ISO_3166_ALPHA_2_MAPPINGS } from "./paths";
export const CurrentCountry: React.FC = () => {
- const paths = countriesPaths.filter((c) => c.class === "US");
+ const country = "US";
+ const paths = countriesPaths.filter((c) => c.class === country);
const joined = paths.map((p) => p.d).join(" ");
const reset = resetPath(joined);
const boundingBox = getBoundingBox(reset);
return (
<AbsoluteFill>
- <svg
- viewBox={boundingBox.viewBox}
- style={{
- height: "100%",
- width: "100%",
- scale: "0.6",
- }}
- >
- <path fill="#222" d={reset} />
- </svg>
+ <AbsoluteFill>
+ <svg
+ viewBox={boundingBox.viewBox}
+ style={{
+ scale: "0.6",
+ }}
+ >
+ <path fill="#222" d={reset} />
+ </svg>
+ </AbsoluteFill>
+ <AbsoluteFill>
+ <div
+ style={{
+ fontFamily: "GT Planar",
+ textAlign: "center",
+ }}
+ >
+ {ISO_3166_ALPHA_2_MAPPINGS[country]}
+ </div>
+ </AbsoluteFill>
</AbsoluteFill>
);
};