2024-05-13 10:12:58 +02:00
|
|
|
import { PenpotFile } from '@ui/lib/types/penpotFile';
|
2024-05-06 08:06:14 +02:00
|
|
|
import { GroupShape } from '@ui/lib/types/shapes/groupShape';
|
2024-04-16 09:24:53 +00:00
|
|
|
import { translateUiBlendMode } from '@ui/translators';
|
2024-04-12 16:52:36 +02:00
|
|
|
|
|
|
|
import { createPenpotItem } from '.';
|
2024-04-08 17:50:01 +02:00
|
|
|
|
|
|
|
export const createPenpotGroup = (
|
2024-04-12 13:55:42 +02:00
|
|
|
file: PenpotFile,
|
2024-04-16 09:24:53 +00:00
|
|
|
{ type, blendMode, children = [], ...rest }: GroupShape
|
2024-04-08 17:50:01 +02:00
|
|
|
) => {
|
2024-04-12 13:55:42 +02:00
|
|
|
file.addGroup({
|
2024-04-16 09:24:53 +00:00
|
|
|
blendMode: translateUiBlendMode(blendMode),
|
2024-04-12 13:55:42 +02:00
|
|
|
...rest
|
2024-04-10 11:14:12 +00:00
|
|
|
});
|
|
|
|
|
2024-04-12 13:55:42 +02:00
|
|
|
for (const child of children) {
|
|
|
|
createPenpotItem(file, child);
|
2024-04-08 17:50:01 +02:00
|
|
|
}
|
2024-04-10 11:14:12 +00:00
|
|
|
|
2024-04-12 13:55:42 +02:00
|
|
|
file.closeGroup();
|
2024-04-08 17:50:01 +02:00
|
|
|
};
|