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/parser/creators/createItems.ts

44 lines
1 KiB
TypeScript
Raw Normal View History

import { PenpotFile } from '@ui/lib/types/penpotFile';
import { PenpotNode } from '@ui/types';
import {
createArtboard,
createBool,
createCircle,
createComponent,
createComponentInstance,
createGroup,
createPath,
createRectangle,
createText
} from '.';
export const createItems = (file: PenpotFile, nodes: PenpotNode[]) => {
for (const node of nodes) {
createItem(file, node);
}
};
const createItem = (file: PenpotFile, node: PenpotNode) => {
switch (node.type) {
case 'rect':
return createRectangle(file, node);
case 'circle':
return createCircle(file, node);
case 'frame':
return createArtboard(file, node);
case 'group':
return createGroup(file, node);
case 'path':
return createPath(file, node);
case 'text':
return createText(file, node);
case 'bool':
return createBool(file, node);
case 'component':
return createComponent(file, node);
case 'instance':
return createComponentInstance(file, node);
}
};