0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2025-01-09 08:30:08 -05:00
penpot-exporter-figma-plugin/plugin-src/transformers/partials/transformLayout.ts

26 lines
931 B
TypeScript
Raw Normal View History

2024-06-10 09:20:04 -05:00
import {
translateLayoutFlexDir,
translateLayoutGap,
translateLayoutJustifyContent,
translateLayoutJustifyItems,
translateLayoutPadding,
translateLayoutWrapType
} from '@plugin/translators';
import { LayoutAttributes } from '@ui/lib/types/shapes/layout';
export const transformAutoLayout = (node: BaseFrameMixin): LayoutAttributes => {
console.log(node);
return {
layout: node.layoutMode !== 'NONE' ? 'flex' : undefined,
layoutFlexDir: translateLayoutFlexDir(node.layoutMode),
layoutGap: translateLayoutGap(node.layoutMode, node.itemSpacing),
layoutWrapType: translateLayoutWrapType(node.layoutWrap),
layoutPadding: translateLayoutPadding(node),
layoutJustifyContent: translateLayoutJustifyContent(node),
layoutJustifyItems: translateLayoutJustifyItems(node),
layoutAlignContent: translateLayoutJustifyContent(node),
layoutAlignItems: translateLayoutJustifyItems(node)
};
};