@@ -5,8 +5,9 @@ import networkLightColoredImg from '../../assets/icons/network-light-colored.png
5
5
import networkDarkNeutralImg from '../../assets/icons/network-dark-neutral.png'
6
6
import networkDarkColoredImg from '../../assets/icons/network-dark-colored.png'
7
7
import { ICON_SIZE , Icon , colors , IconImg } from './styled'
8
+ import { IconType } from './types'
8
9
9
- const getData = currentColors => {
10
+ const getData = ( currentColors : any ) => {
10
11
let nodes = 'ABCDE' . split ( '' ) . map ( id => ( {
11
12
id,
12
13
radius : 5 ,
@@ -18,7 +19,7 @@ const getData = currentColors => {
18
19
distance : 2 ,
19
20
} ) )
20
21
21
- const leaves = [ ]
22
+ const leaves : any [ ] = [ ]
22
23
nodes . forEach ( node => {
23
24
Array . from ( { length : 7 } , ( v , k ) => {
24
25
leaves . push ( {
@@ -43,21 +44,22 @@ const getData = currentColors => {
43
44
const chartProps = {
44
45
width : ICON_SIZE ,
45
46
height : ICON_SIZE ,
46
- distance : link => link . distance ,
47
+ linkDistance : ( link : any ) => link . distance ,
47
48
repulsivity : 5 ,
48
49
linkThickness : 2 ,
50
+ nodeColor : ( node : any ) => node . color ,
49
51
linkColor : { from : 'source.color' } ,
50
52
animate : false ,
51
53
isInteractive : false ,
52
54
}
53
55
54
- const NetworkIconItem = ( { type } ) => (
56
+ const NetworkIconItem = ( { type } : { type : IconType } ) => (
55
57
< Icon id = { `network-${ type } ` } type = { type } >
56
- < Network { ...chartProps } { ... getData ( colors [ type ] . colors ) } />
58
+ < Network { ...chartProps } data = { getData ( colors [ type ] . colors ) } />
57
59
</ Icon >
58
60
)
59
61
60
- const NetworkIcon = ( ) => (
62
+ export const NetworkIcon = ( ) => (
61
63
< >
62
64
< NetworkIconItem type = "lightNeutral" />
63
65
< IconImg url = { networkLightNeutralImg } />
@@ -69,5 +71,3 @@ const NetworkIcon = () => (
69
71
< IconImg url = { networkDarkColoredImg } />
70
72
</ >
71
73
)
72
-
73
- export default NetworkIcon
0 commit comments