0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 13:43:03 -05:00
penpot-exporter-figma-plugin/ui-src/converters/createPenpotGroup.ts
2024-04-12 18:52:19 +02:00

22 lines
542 B
TypeScript

import { PenpotFile } from '@ui/lib/penpot';
import { GROUP_TYPE } from '@ui/lib/types/group/groupAttributes';
import { GroupShape } from '@ui/lib/types/group/groupShape';
import { createPenpotItem } from '.';
export const createPenpotGroup = (
file: PenpotFile,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
{ type, children = [], ...rest }: GroupShape
) => {
file.addGroup({
type: GROUP_TYPE,
...rest
});
for (const child of children) {
createPenpotItem(file, child);
}
file.closeGroup();
};