0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2025-01-24 00:08:46 -05:00
penpot-exporter-figma-plugin/ui-src/converters/createPenpotGroup.ts

24 lines
593 B
TypeScript
Raw Normal View History

import { PenpotFile } from '@ui/lib/penpot';
import { GROUP_TYPE } from '@ui/lib/types/group/groupAttributes';
import { GroupShape } from '@ui/lib/types/group/groupShape';
2024-04-16 09:24:53 +00:00
import { translateUiBlendMode } from '@ui/translators';
import { createPenpotItem } from '.';
2024-04-08 17:50:01 +02:00
export const createPenpotGroup = (
file: PenpotFile,
2024-04-16 09:24:53 +00:00
{ type, blendMode, children = [], ...rest }: GroupShape
2024-04-08 17:50:01 +02:00
) => {
file.addGroup({
type: GROUP_TYPE,
2024-04-16 09:24:53 +00:00
blendMode: translateUiBlendMode(blendMode),
...rest
2024-04-10 11:14:12 +00: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
file.closeGroup();
2024-04-08 17:50:01 +02:00
};