🎥 Make videos programmatically with React
parametrized props
Jonny Burger34395039979c
diff --git a/packages/docs/components/shapes/shapes-info.tsx b/packages/docs/components/shapes/shapes-info.tsxindex c10ef390b5..b43298cd1e 100644--- a/packages/docs/components/shapes/shapes-info.tsx+++ b/packages/docs/components/shapes/shapes-info.tsx@@ -74,7 +74,8 @@ export const shapeComponents = [export const ShapeOptions: React.FC<{shape: string;-}> = ({ shape }) => {+ all: boolean;+}> = ({ shape, all }) => {const shapeComponent = shapeComponents.find((c) => c.shape.toLowerCase() === shape.toLowerCase());@@ -94,6 +95,7 @@ export const ShapeOptions: React.FC<{</React.Fragment>);})}+ ALL</React.Fragment>);};@@ -119,7 +121,37 @@ export const MakeShapeSeeAlso: React.FC<{</li><li><a- href={`https://github.com/remotion-dev/remotion/blob/main/packages/shapes/src/make-${shape.toLowerCase()}.ts`}+ href={`https://github.com/remotion-dev/remotion/blob/main/packages/shapes/src/utils/make-${shape.toLowerCase()}.ts`}+ >+ Source code for this function+ </a>+ </li>+ </ul>+ );+};++export const ShapeSeeAlso: React.FC<{+ shape: string;+}> = ({ shape }) => {+ const shapeComponent = shapeComponents.find(+ (c) => c.shape.toLowerCase() === shape.toLowerCase()+ );++ return (+ <ul>+ <li>+ <a+ href={`/docs/shapes/${shapeComponent.shape.toLowerCase()}`}+ >{`make${shapeComponent.shape}()`}</a>+ </li>+ <li>+ <a href={`/docs/shapes`}>+ <code>@remotion/shapes</code>+ </a>+ </li>+ <li>+ <a+ href={`https://github.com/remotion-dev/remotion/blob/main/packages/shapes/src/components/${shape.toLowerCase()}.tsx`}>Source code for this function</a>diff --git a/packages/docs/docs/shapes/circle.md b/packages/docs/docs/shapes/circle.mdindex de21f75316..3e32f560f7 100644--- a/packages/docs/docs/shapes/circle.md+++ b/packages/docs/docs/shapes/circle.md@@ -3,26 +3,19 @@ title: <Circle />crumb: "@remotion/shapes"----_Part of the [` @remotion/shapes`](/docs/shapes) package._+import {ShapeSeeAlso, ShapeOptions} from "../../components/shapes/shapes-info"-Generates Circle SVG component+_Part of the [`@remotion/shapes`](/docs/shapes) package._-## Arguments+Renders an SVG element drawing a circle.-### `options`+## Props-An object with the following arguments:+<ShapeOptions shape="circle" all />-- `width`: `number` - The width of the circle-- `height`: `number` - The height of the circle-- `fill`: `string` `optional` - The color of the fill-- `stroke`: `string` - The color of the stroke-- `strokeWidth`: `number` - The width of the stroke-- `style`: `React.CSSProperties` - The css styles applied to `svg` component+## Example-Use Circle SVG into Remotion--```tsx twoslash+```tsx twoslash title="src/Circle.tsx"import { Circle } from "@remotion/shapes";import { AbsoluteFill } from "remotion";@@ -35,13 +28,7 @@ export const MyComposition = () => {alignItems: "center",}}>- <Circle- width={100}- height={100}- fill="green"- stroke="red"- strokeWidth={1}- />+ <Circle radius={100} fill="green" stroke="red" strokeWidth={1} /></AbsoluteFill>);};diff --git a/packages/docs/docs/shapes/ellipse.md b/packages/docs/docs/shapes/ellipse.mdindex 982c075a96..d88fc93a1e 100644--- a/packages/docs/docs/shapes/ellipse.md+++ b/packages/docs/docs/shapes/ellipse.md@@ -3,24 +3,19 @@ title: <Ellipse />crumb: "@remotion/shapes"----_Part of the [` @remotion/shapes`](/docs/shapes) package._+import {ShapeSeeAlso, ShapeOptions} from "../../components/shapes/shapes-info"-Renders an SVG element drawing an ellipse+_Part of the [` @remotion/shapes`](/docs/shapes) package._-## Arguments+Renders an SVG element drawing an ellipse.-### `options`+## Props-An object with the following arguments:+<ShapeOptions shape="ellipse" all />-- `rx`: `number` - The x-axis radius of the ellipse-- `ry`: `number` - The y-axis radius of the ellipse-- `fill`: `string` `optional` - The color of the fill-- `stroke`: `string` - The color of the stroke-- `strokeWidth`: `number` - The width of the stroke-- `style`: `React.CSSProperties` - The css styles applied to `svg` component+## Example-```tsx twoslash+```tsx twoslash title="src/Ellipse.tsx"import { Ellipse } from "@remotion/shapes";import { AbsoluteFill } from "remotion";@@ -41,6 +36,4 @@ export const MyComposition = () => {## See also-- [makeEllipse()](/docs/shapes/make-ellipse)-- [`@remotion/shapes`](/docs/shapes)-- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/shapes/src/ellipse.tsx)+<ShapeSeeAlso shape="ellipse"/>diff --git a/packages/docs/docs/shapes/index.md b/packages/docs/docs/shapes/index.mdindex 8ef6f0180b..4ffee8a235 100644--- a/packages/docs/docs/shapes/index.md+++ b/packages/docs/docs/shapes/index.md@@ -1,7 +1,7 @@---image: /generated/articles-docs-shapes-index.pngtitle: "@remotion/shapes"-crumb: "SVG"+crumb: "SVG component library"---import {TableOfContents} from '../../components/TableOfContents/shapes';diff --git a/packages/docs/docs/shapes/rect.md b/packages/docs/docs/shapes/rect.mdindex bcdfa6adb0..d7ffbab97a 100644--- a/packages/docs/docs/shapes/rect.md+++ b/packages/docs/docs/shapes/rect.md@@ -3,39 +3,20 @@ title: <Rect />crumb: "@remotion/shapes"---+import {ShapeSeeAlso, ShapeOptions} from "../../components/shapes/shapes-info"+_Part of the [` @remotion/shapes`](/docs/shapes) package._-Generate a rectangle using SVG+Renders an SVG element containing a rectangle.## Props-### `width`--_number_--The width of the rect and the view box.--### `height`--_number_--The height of the rect and the view box.--### `fill`--_string_--The fill color of the rect.--### `style`--_`React.CSSProperties`, optional_--CSS styles applied to `svg` element.+<ShapeOptions shape="rect" all />## Example-```tsx twoslash+```tsx twoslash title="src/Rect.tsx"+import { Rect } from "@remotion/shapes";import { AbsoluteFill } from "remotion";export const MyComposition = () => {@@ -55,7 +36,4 @@ export const MyComposition = () => {## See also-- [makeTriangle()](/docs/shapes/make-triangle)-- [makeRect()](/docs/shapes/make-rect)-- [`@remotion/shapes`](/docs/shapes)-- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/shapes/src/rect.tsx)+<ShapeSeeAlso shape="rect"/>diff --git a/packages/docs/docs/shapes/triangle.md b/packages/docs/docs/shapes/triangle.mdindex 676aebe095..21683d446c 100644--- a/packages/docs/docs/shapes/triangle.md+++ b/packages/docs/docs/shapes/triangle.md@@ -3,25 +3,19 @@ title: <Triangle />crumb: "@remotion/shapes"----_Part of the [` @remotion/shapes`](/docs/shapes) package._--Generate Triangle SVG component+import {ShapeSeeAlso, ShapeOptions} from "../../components/shapes/shapes-info"-## Arguments+_Part of the [` @remotion/shapes`](/docs/shapes) package._-### `options`+Renders an SVG element containing a triangle.-An object with the following arguments:+## Props-- `width`: `number` - The width of the triangle-- `height`: `number` - he height of the triangle-- `fill`: `string` `optional` - The fill color-- `direction`: `string` - The identifier what kind of rectangle, possible values `left`, `right`, `top` and `bottom`-- `style`: `React.CSSProperties` - The radius of the circle. A value lower or equal to zero disables rendering of the circle+<ShapeOptions shape="ellipse" all />-Example Triangle SVG+## Example-```tsx twoslash+```tsx twoslash title="src/Triangle.tsx"import { Triangle } from "@remotion/shapes";import { AbsoluteFill } from "remotion";@@ -34,7 +28,7 @@ export const MyComposition = () => {alignItems: "center",}}>- <Triangle width={100} height={100} fill="red" direction="left" />+ <Triangle length={100} fill="red" direction="left" /></AbsoluteFill>);};@@ -42,5 +36,4 @@ export const MyComposition = () => {## See also-- [makeTriangle()](/docs/shapes/make-triangle)-- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/shapes/src/triangle.tsx)+<ShapeSeeAlso shape="triangle"/>