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

Function htmlGroup

packages/backend/src/html/htmlMain.ts:447–468  ·  view source on GitHub ↗
(
  node: GroupNode,
  settings: HTMLSettings,
)

Source from the content-addressed store, hash-verified

445};
446
447const htmlGroup = async (
448 node: GroupNode,
449 settings: HTMLSettings,
450): Promise<string> => {
451 // ignore the view when size is zero or less
452 // while technically it shouldn't get less than 0, due to rounding errors,
453 // it can get to values like: -0.000004196293048153166
454 // also ignore if there are no children inside, which makes no sense
455 if (node.width < 0 || node.height <= 0 || node.children.length === 0) {
456 return "";
457 }
458
459 // this needs to be called after CustomNode because widthHeight depends on it
460 const builder = new HtmlDefaultBuilder(node, settings).commonPositionStyles();
461
462 if (builder.styles) {
463 const attr = builder.build();
464 const generator = await htmlWidgetGenerator(node.children, settings);
465 return `\n<div${attr}>${indentString(generator)}\n</div>`;
466 }
467 return await htmlWidgetGenerator(node.children, settings);
468};
469
470// For htmlText and htmlContainer, use the htmlGenerationMode to determine styling approach
471const htmlText = (node: TextNode, settings: HTMLSettings): string => {

Callers 1

convertNodeFunction · 0.85

Calls 4

indentStringFunction · 0.90
htmlWidgetGeneratorFunction · 0.85
commonPositionStylesMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected