Skip to content

🎥 Make videos programmatically with React

og card

Jonny Burgerf8f3e568c53c
diff --git a/packages/docs/docs/paths/get-instruction-index-at-length.md b/packages/docs/docs/paths/get-instruction-index-at-length.md
index 2fed7415da..79015812b4 100644
--- a/packages/docs/docs/paths/get-instruction-index-at-length.md
+++ b/packages/docs/docs/paths/get-instruction-index-at-length.md
@@ -1,4 +1,5 @@
---
+image: /generated/articles-docs-paths-get-instruction-index-at-length.png
title: getInstructionIndexAtLength()
crumb: "@remotion/paths"
---
diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.ts
index 9bd15c93c1..40d3ec9642 100644
--- a/packages/docs/src/data/articles.ts
+++ b/packages/docs/src/data/articles.ts
@@ -1765,6 +1765,13 @@ export const articles = [
compId: "articles-docs-paths-get-bounding-box",
crumb: "@remotion/paths",
},
+ {
+ id: "paths/get-instruction-index-at-length",
+ title: "getInstructionIndexAtLength()",
+ relativePath: "docs/paths/get-instruction-index-at-length.md",
+ compId: "articles-docs-paths-get-instruction-index-at-length",
+ crumb: "@remotion/paths",
+ },
{
id: "paths/get-length",
title: "getLength()",
diff --git a/packages/docs/src/remotion/Article.tsx b/packages/docs/src/remotion/Article.tsx
index ff28cc7fb2..2fa152bc7f 100644
--- a/packages/docs/src/remotion/Article.tsx
+++ b/packages/docs/src/remotion/Article.tsx
@@ -6,7 +6,12 @@ import "./font.css";
export const Article: React.FC<{
articleRelativePath: string;
}> = ({ articleRelativePath }) => {
- const expert = articles.find((e) => e.relativePath === articleRelativePath);
+ const article = articles.find((e) => e.relativePath === articleRelativePath);
+ const longestTitle = Math.max(
+ ...article.title.split(" ").map((p) => p.length),
+ );
+
+ const fontSize = longestTitle > 20 ? 70 : 80;
return (
<AbsoluteFill
@@ -24,7 +29,7 @@ export const Article: React.FC<{
}}
>
<div>
- {expert.crumb ? (
+ {article.crumb ? (
<div
style={{
flexDirection: "row",
@@ -42,7 +47,7 @@ export const Article: React.FC<{
backgroundColor: "white",
}}
>
- {expert.crumb}
+ {article.crumb}
</div>
</div>
) : null}
@@ -67,10 +72,10 @@ export const Article: React.FC<{
style={{
color: "white",
fontFamily: "GTPlanar",
- fontSize: 80,
+ fontSize,
}}
>
- {expert.title}
+ {article.title}
</div>
</div>
</div>
diff --git a/packages/docs/static/generated/articles-docs-paths-get-instruction-index-at-length.png b/packages/docs/static/generated/articles-docs-paths-get-instruction-index-at-length.png
new file mode 100644
index 0000000000..2997f3b414
Binary files /dev/null and b/packages/docs/static/generated/articles-docs-paths-get-instruction-index-at-length.png differ