MCPcopy Index your code
hub / github.com/bernaferrari/FigmaToCode / tailwindFrame

Function tailwindFrame

packages/backend/src/tailwind/tailwindMain.ts:172–199  ·  view source on GitHub ↗
(
  node: FrameNode | InstanceNode | ComponentNode | ComponentSetNode,
  settings: TailwindSettings,
)

Source from the content-addressed store, hash-verified

170};
171
172const tailwindFrame = async (
173 node: FrameNode | InstanceNode | ComponentNode | ComponentSetNode,
174 settings: TailwindSettings,
175): Promise<string> => {
176 // Check if this is an instance and should be rendered as a Twig component
177 if (node.type === "INSTANCE" && isTwigComponentNode(node)) {
178 return tailwindTwigComponentInstance(node, settings);
179 }
180
181 const childrenStr = await tailwindWidgetGenerator(node.children, settings);
182
183 const clipsContentClass =
184 node.clipsContent && "children" in node && node.children.length > 0
185 ? "overflow-hidden"
186 : "";
187 let layoutProps = "";
188
189 if (node.layoutMode !== "NONE") {
190 layoutProps = tailwindAutoLayoutProps(node, node);
191 }
192
193 // Combine classes properly, ensuring no extra spaces
194 const combinedProps = [layoutProps, clipsContentClass]
195 .filter(Boolean)
196 .join(" ");
197
198 return tailwindContainer(node, childrenStr, combinedProps, settings);
199};
200
201
202// Helper function to generate Twig component syntax for component instances

Callers 1

convertNodeFunction · 0.85

Calls 5

tailwindAutoLayoutPropsFunction · 0.90
isTwigComponentNodeFunction · 0.85
tailwindWidgetGeneratorFunction · 0.85
tailwindContainerFunction · 0.85

Tested by

no test coverage detected