0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 21:53:27 -05:00
penpot-exporter-figma-plugin/ui-src/converters/createPenpotGroup.ts

22 lines
516 B
TypeScript
Raw Normal View History

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