2024-05-13 10:12:58 +02:00
|
|
|
import { PenpotFile } from '@ui/lib/types/penpotFile';
|
2024-05-06 08:06:14 +02:00
|
|
|
import { RectShape } from '@ui/lib/types/shapes/rectShape';
|
2024-05-30 17:54:37 +02:00
|
|
|
import { parseFigmaId } from '@ui/parser';
|
2024-06-05 12:36:49 +02:00
|
|
|
import { symbolBlendMode, symbolFills, symbolStrokes } from '@ui/parser/creators/symbols';
|
2024-04-08 17:50:01 +02:00
|
|
|
|
2024-05-29 12:52:21 +02:00
|
|
|
export const createRectangle = (
|
2024-04-15 14:03:30 +02:00
|
|
|
file: PenpotFile,
|
2024-06-05 12:36:49 +02:00
|
|
|
{ type, fills, strokes, blendMode, figmaId, figmaRelatedId, ...rest }: RectShape
|
2024-04-15 14:03:30 +02:00
|
|
|
) => {
|
2024-04-12 13:55:42 +02:00
|
|
|
file.createRect({
|
2024-05-30 17:54:37 +02:00
|
|
|
id: parseFigmaId(file, figmaId),
|
|
|
|
shapeRef: parseFigmaId(file, figmaRelatedId, true),
|
2024-06-03 17:29:33 +02:00
|
|
|
fills: symbolFills(fills),
|
2024-06-05 12:36:49 +02:00
|
|
|
strokes: symbolStrokes(strokes),
|
2024-05-29 12:52:21 +02:00
|
|
|
blendMode: symbolBlendMode(blendMode),
|
2024-04-12 13:55:42 +02:00
|
|
|
...rest
|
2024-04-08 17:50:01 +02:00
|
|
|
});
|
|
|
|
};
|