mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2024-12-22 21:53:27 -05:00
7b3192936e
* wip * wip * wipo * more structure * wip * id library wip * wip * main instance working * improvements * fix node order * refactor * remove not used method * refactor * fix component set translation * refactor * add changelog * penpot lib update --------- Co-authored-by: Jordi Sala Morales <jordism91@gmail.com>
43 lines
1 KiB
TypeScript
43 lines
1 KiB
TypeScript
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);
|
|
}
|
|
};
|