Skip to content

Commit 5c4614e

Browse files
committed
chore: add componentProperties to resolve additional code props
1 parent 8055292 commit 5c4614e

File tree

6 files changed

+557
-312
lines changed

6 files changed

+557
-312
lines changed

packages/codegen/manifest.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
"propertyName": "maxDepth",
2424
"label": "Max Depth (how many children should be included - performance)",
2525
"options": [
26-
{ "label": "4", "value": "4", "isDefault": true },
27-
{ "label": "5", "value": "5" },
26+
{ "label": "5", "value": "5", "isDefault": true },
2827
{ "label": "6", "value": "6" },
2928
{ "label": "7", "value": "7" }
3029
]

packages/shared/data.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export type OutputNode = {
2626
};
2727
children?: OutputNode[];
2828
variantProperties?: { [p: string]: string } | null;
29+
componentProperties?: Record<string, string | boolean>;
2930
mainComponentName?: string;
3031
componentName?: string;
3132
};

packages/shared/figma/generate.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ export const getNodesRecursive = async (
2020
if (node.type === "INSTANCE") {
2121
if (node.variantProperties) {
2222
result.variantProperties = node.variantProperties;
23+
if (node.componentProperties) {
24+
result.componentProperties = Object.entries(
25+
node.componentProperties,
26+
).reduce((previousValue, [key, prop]) => {
27+
return { ...previousValue, [key.split("#")[0]]: prop.value };
28+
}, {});
29+
}
2330
}
2431

2532
const mainComponent = await node.getMainComponentAsync();

packages/shared/generate/code.ts

Lines changed: 0 additions & 310 deletions
This file was deleted.

0 commit comments

Comments
 (0)