MCPcopy Create free account
hub / github.com/bernaferrari/FigmaToCode / nodeSize

Function nodeSize

packages/backend/src/common/nodeWidthHeight.ts:3–23  ·  view source on GitHub ↗
(node: SceneNode)

Source from the content-addressed store, hash-verified

1import { Size } from "types";
2
3export const nodeSize = (node: SceneNode): Size => {
4 if ("layoutSizingHorizontal" in node && "layoutSizingVertical" in node) {
5 const width =
6 node.layoutSizingHorizontal === "FILL"
7 ? "fill"
8 : node.layoutSizingHorizontal === "HUG"
9 ? null
10 : node.width;
11
12 const height =
13 node.layoutSizingVertical === "FILL"
14 ? "fill"
15 : node.layoutSizingVertical === "HUG"
16 ? null
17 : node.height;
18
19 return { width, height };
20 }
21
22 return { width: node.width, height: node.height };
23};

Callers 4

flutterSizeFunction · 0.90
tailwindSizePartialFunction · 0.90
htmlSizePartialFunction · 0.90
swiftuiSizeFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected