You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/app/components/StateRoute/ComponentMap/ComponentMap.tsx
+57-9Lines changed: 57 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -325,16 +325,60 @@ export default function ComponentMap({
325
325
})}
326
326
327
327
{tree.descendants().map((node,key)=>{
328
-
constwidthFunc: number=(name)=>{
329
-
//returns a number that is related to the length of the name. Used for determining the node width.
330
-
constnodeLength=name.length;
331
-
// return nodeLength * 7 + 20; //uncomment this line if we want each node to be directly proportional to the name.length (instead of nodes of similar sizes to snap to the same width)
328
+
constcalculateNodeWidth=(text: string): number=>{
329
+
constnodeLength=text.length;
332
330
if(nodeLength<=5)returnnodeLength+50;
333
331
if(nodeLength<=10)returnnodeLength+120;
334
332
returnnodeLength+140;
335
333
};
336
334
337
-
constwidth: number=widthFunc(node.data.name);// the width is determined by the length of the node.name
0 commit comments