Skip to content

🎥 Make videos programmatically with React

inherit styles

Jonny Burger55f8c43ed3ff
diff --git a/packages/shapes/src/components/Ellipse.tsx b/packages/shapes/src/components/Ellipse.tsx
index 382a95fc13..5051f42c91 100644
--- a/packages/shapes/src/components/Ellipse.tsx
+++ b/packages/shapes/src/components/Ellipse.tsx
@@ -1,23 +1,12 @@
import type React from 'react';
import type {MakeEllipseOptions} from '../make-ellipse';
import {makeEllipse} from '../make-ellipse';
+import type {AllShapesProps} from './render-svg';
import {renderSvg} from './render-svg';
-export type EllipseProps = MakeEllipseOptions & {
- fill?: string;
- stroke?: string;
- strokeWidth?: number;
- style?: React.CSSProperties;
-};
+export type EllipseProps = MakeEllipseOptions & AllShapesProps;
-export const Ellipse: React.FC<EllipseProps> = ({
- fill,
- stroke,
- strokeWidth,
- rx,
- ry,
- style,
-}) => {
+export const Ellipse: React.FC<EllipseProps> = ({rx, ry, ...props}) => {
const path = makeEllipse({
rx,
ry,
@@ -27,9 +16,6 @@ export const Ellipse: React.FC<EllipseProps> = ({
height: ry * 2,
path,
width: rx * 2,
- fill,
- style,
- strokeWidth,
- stroke,
+ ...props,
});
};
diff --git a/packages/shapes/src/components/circle.tsx b/packages/shapes/src/components/circle.tsx
index 299c34cdef..6a2fef5607 100644
--- a/packages/shapes/src/components/circle.tsx
+++ b/packages/shapes/src/components/circle.tsx
@@ -6,13 +6,7 @@ import {renderSvg} from './render-svg';
export type CircleProps = MakeCircleProps & AllShapesProps;
-export const Circle: React.FC<CircleProps> = ({
- fill,
- stroke,
- strokeWidth,
- style,
- radius,
-}) => {
+export const Circle: React.FC<CircleProps> = ({fill, radius, ...props}) => {
const size = radius * 2;
return renderSvg({
@@ -22,8 +16,6 @@ export const Circle: React.FC<CircleProps> = ({
height: size,
width: size,
fill,
- stroke,
- strokeWidth,
- style,
+ ...props,
});
};
diff --git a/packages/shapes/src/components/rect.tsx b/packages/shapes/src/components/rect.tsx
index 894610b941..7e503f1b9b 100644
--- a/packages/shapes/src/components/rect.tsx
+++ b/packages/shapes/src/components/rect.tsx
@@ -1,15 +1,19 @@
import type React from 'react';
import {makeRect} from '../make-rect';
+import type {AllShapesProps} from './render-svg';
import {renderSvg} from './render-svg';
export type SquareProps = {
width: number;
height: number;
- fill?: string;
- style?: React.CSSProperties;
-};
+} & AllShapesProps;
-export const Rect: React.FC<SquareProps> = ({width, height, fill, style}) => {
+export const Rect: React.FC<SquareProps> = ({
+ width,
+ height,
+ fill,
+ ...props
+}) => {
return renderSvg({
fill,
height,
@@ -18,6 +22,6 @@ export const Rect: React.FC<SquareProps> = ({width, height, fill, style}) => {
height,
}),
width,
- style,
+ ...props,
});
};
diff --git a/packages/shapes/src/components/triangle.tsx b/packages/shapes/src/components/triangle.tsx
index 82588163f4..6f235adee9 100644
--- a/packages/shapes/src/components/triangle.tsx
+++ b/packages/shapes/src/components/triangle.tsx
@@ -1,12 +1,10 @@
import type React from 'react';
import type {MakeTriangleProps} from '../make-triangle';
import {makeTriangle} from '../make-triangle';
+import type {AllShapesProps} from './render-svg';
import {renderSvg} from './render-svg';
-export type TriangleProps = MakeTriangleProps & {
- fill?: string;
- style?: React.CSSProperties;
-};
+export type TriangleProps = MakeTriangleProps & AllShapesProps;
export const Triangle: React.FC<TriangleProps> = ({
// TODO: Do not use width and height, but use length of a side
@@ -14,7 +12,7 @@ export const Triangle: React.FC<TriangleProps> = ({
height,
fill,
direction,
- style,
+ ...props
}) => {
return renderSvg({
fill,
@@ -24,7 +22,7 @@ export const Triangle: React.FC<TriangleProps> = ({
height,
direction,
}),
- style,
+ ...props,
width,
});
};