File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ interface TreeNode {
29
29
30
30
type HierarchyNode = HierarchyPointNode < TreeNode > ;
31
31
32
- const defaultMargin = { top : 30 , left : 30 , right : 30 , bottom : 70 } ;
32
+ const defaultMargin = { top : 30 , left : 30 , right : 55 , bottom : 70 } ;
33
33
34
34
export type LinkTypesProps = {
35
35
width : number ;
@@ -125,9 +125,15 @@ export default function ComponentMap({
125
125
) ) }
126
126
127
127
{ tree . descendants ( ) . map ( ( node , key ) => {
128
- const width = 65 ;
128
+ // const width = (node.data.name.length) + 70;
129
+ const widthFunc = ( name ) => {
130
+ let nodeLength = name . length ;
131
+ if ( nodeLength < 5 ) return nodeLength + 40 ;
132
+ if ( nodeLength < 10 ) return nodeLength + 60 ;
133
+ return nodeLength + 70 ;
134
+ }
135
+ const width = widthFunc ( node . data . name ) ;
129
136
const height = 25 ;
130
-
131
137
132
138
let top : number ;
133
139
let left : number ;
@@ -194,7 +200,7 @@ export default function ComponentMap({
194
200
{ /* Display text inside of each component node */ }
195
201
< text
196
202
dy = '.33em'
197
- fontSize = { 8 }
203
+ fontSize = { 10 }
198
204
fontFamily = 'Roboto'
199
205
textAnchor = 'middle'
200
206
style = { { pointerEvents : 'none' } }
You can’t perform that action at this time.
0 commit comments