@@ -2,113 +2,118 @@ import React, { Component, useEffect, useState, Fragment } from 'react';
2
2
import { Chart } from 'react-google-charts' ;
3
3
4
4
function AtomsRelationship ( props ) {
5
- const { atomsRel } = props ;
5
+ const { atomsComponent , atomSelectors } = props ;
6
+ console . log ( props )
6
7
7
- const atomsAndComp = atomsRel
8
- . filter ( ( e ) => e [ 2 ] !== 'atoms and selectors' )
9
- . map ( ( e ) => {
10
- let copy = [ ...e ] ;
11
- copy [ 2 ] = 1 ;
12
- return [ ...copy ] ;
13
- } ) ;
8
+ // const atomsAndComp = atomsRel
9
+ // .filter((e) => e[2] !== 'atoms and selectors')
10
+ // .map((e) => {
11
+ // let copy = [...e];
12
+ // copy[2] = 1;
13
+ // return [...copy];
14
+ // });
14
15
15
- const atomsAndSelectors = atomsRel
16
- . filter ( ( e ) => e [ 2 ] === 'atoms and selectors' )
17
- . map ( ( e ) => {
18
- let copy = [ ...e ] ;
19
- copy [ 2 ] = 1 ;
20
- return [ ...copy ] ;
21
- } ) ;
16
+ // const atomsAndSelectors = atomsRel
17
+ // .filter((e) => e[2] === 'atoms and selectors')
18
+ // .map((e) => {
19
+ // let copy = [...e];
20
+ // copy[2] = 1;
21
+ // return [...copy];
22
+ // });
22
23
23
- const copyatomsRel = atomsRel . map ( ( e ) => {
24
- let copy = [ ...e ] ;
25
- copy [ 2 ] = 1 ;
26
- return copy ;
27
- } ) ;
28
- const [ atoms , setAtoms ] = useState ( [ ...copyatomsRel ] ) ;
29
- const [ atomAndSelectorCheck , setAtomAndSelectorCheck ] = useState ( false ) ;
30
- const [ atomAndCompCheck , setAtomAndCompCheck ] = useState ( false ) ;
24
+ // const copyatomsRel = atomsRel.map((e) => {
25
+ // let copy = [...e];
26
+ // copy[2] = 1;
27
+ // return copy;
28
+ // });
29
+ // const [atoms, setAtoms] = useState([...copyatomsRel]);
30
+ // const [atomAndSelectorCheck, setAtomAndSelectorCheck] = useState(false);
31
+ // const [atomAndCompCheck, setAtomAndCompCheck] = useState(false);
31
32
32
- useEffect ( ( ) => {
33
- if (
34
- ( ! atomAndSelectorCheck && ! atomAndCompCheck ) ||
35
- ( atomAndSelectorCheck && atomAndCompCheck )
36
- ) {
37
- setAtoms ( copyatomsRel ) ;
38
- } else if ( atomAndSelectorCheck ) {
39
- setAtoms ( atomsAndSelectors ) ;
40
- } else {
41
- setAtoms ( atomsAndComp ) ;
42
- }
43
- } , [ atomAndSelectorCheck , atomAndCompCheck , props ] ) ;
33
+ // useEffect(() => {
34
+ // if (
35
+ // (!atomAndSelectorCheck && !atomAndCompCheck) ||
36
+ // (atomAndSelectorCheck && atomAndCompCheck)
37
+ // ) {
38
+ // setAtoms(copyatomsRel);
39
+ // } else if (atomAndSelectorCheck) {
40
+ // setAtoms(atomsAndSelectors);
41
+ // } else {
42
+ // setAtoms(atomsAndComp);
43
+ // }
44
+ // }, [atomAndSelectorCheck, atomAndCompCheck, props]);
44
45
45
46
return (
46
- < div className = "history-d3-container" >
47
- { atoms && (
48
- < Fragment >
49
- < Chart
50
- width = { '100%' }
51
- height = { '98%' }
52
- chartType = "Sankey"
53
- options = { {
54
- sankey : {
55
- link : { color : { fill : '#gray' , fillOpacity : 0.1 } } ,
56
- node : {
57
- colors : [
58
- '#4a91c7' ,
59
- '#5b9bce' ,
60
- '#6ba6d5' ,
61
- '#7bb0dc' ,
62
- '#8abbe3' ,
63
- '#99c6ea' ,
64
- '#a8d0f1' ,
65
- '#b7dbf8' ,
66
- '#c6e6ff' ,
67
- '#46edf2' ,
68
- '#76f5f3' ,
69
- '#95B6B7' ,
70
- '#76dcde' ,
71
- '#5fdaed' ,
72
- ] ,
73
-
74
- label : { color : '#fff' , fontSize : '13' , fontName : 'Monaco' } ,
75
- nodePadding : 50 ,
76
- width : 15 ,
77
- } ,
78
- } ,
79
- tooltip : { textStyle : { color : 'white' , fontSize : 0.1 } } ,
80
- } }
81
- loader = { < div > Loading Chart</ div > }
82
- data = { [ [ 'Atom' , 'Selector' , '' ] , ...atoms ] }
83
- rootProps = { { 'data-testid' : '1' } }
84
- />
85
- < div >
86
- < input
87
- type = "checkbox"
88
- id = "atomscomps"
89
- onClick = { ( e ) =>
90
- setAtomAndCompCheck ( atomAndCompCheck ? false : true )
91
- }
92
- />
93
- < label htmlFor = "atomscomps" >
94
- { ' ' }
95
- Only Show Atoms (or Selectors) and Components{ ' ' }
96
- </ label >
97
- < input
98
- type = "checkbox"
99
- id = "atomsselectors"
100
- onClick = { ( e ) =>
101
- setAtomAndSelectorCheck ( atomAndSelectorCheck ? false : true )
102
- }
103
- />
104
- < label htmlFor = "atomsselectors" >
105
- { ' ' }
106
- Only Show Atoms and Selectors{ ' ' }
107
- </ label >
108
- </ div >
109
- </ Fragment >
110
- ) }
47
+
48
+ < div >
49
+ Hello
111
50
</ div >
51
+ // <div className="history-d3-container">
52
+ // {atoms && (
53
+ // <Fragment>
54
+ // <Chart
55
+ // width={'100%'}
56
+ // height={'98%'}
57
+ // chartType="Sankey"
58
+ // options={{
59
+ // sankey: {
60
+ // link: { color: { fill: '#gray', fillOpacity: 0.1 } },
61
+ // node: {
62
+ // colors: [
63
+ // '#4a91c7',
64
+ // '#5b9bce',
65
+ // '#6ba6d5',
66
+ // '#7bb0dc',
67
+ // '#8abbe3',
68
+ // '#99c6ea',
69
+ // '#a8d0f1',
70
+ // '#b7dbf8',
71
+ // '#c6e6ff',
72
+ // '#46edf2',
73
+ // '#76f5f3',
74
+ // '#95B6B7',
75
+ // '#76dcde',
76
+ // '#5fdaed',
77
+ // ],
78
+
79
+ // label: { color: '#fff', fontSize: '13', fontName: 'Monaco' },
80
+ // nodePadding: 50,
81
+ // width: 15,
82
+ // },
83
+ // },
84
+ // tooltip: { textStyle: { color: 'white', fontSize: 0.1 } },
85
+ // }}
86
+ // loader={<div>Loading Chart</div>}
87
+ // data={[['Atom', 'Selector', ''], ...atoms]}
88
+ // rootProps={{ 'data-testid': '1' }}
89
+ // />
90
+ // <div>
91
+ // <input
92
+ // type="checkbox"
93
+ // id="atomscomps"
94
+ // onClick={(e) =>
95
+ // setAtomAndCompCheck(atomAndCompCheck ? false : true)
96
+ // }
97
+ // />
98
+ // <label htmlFor="atomscomps">
99
+ // {' '}
100
+ // Only Show Atoms (or Selectors) and Components{' '}
101
+ // </label>
102
+ // <input
103
+ // type="checkbox"
104
+ // id="atomsselectors"
105
+ // onClick={(e) =>
106
+ // setAtomAndSelectorCheck(atomAndSelectorCheck ? false : true)
107
+ // }
108
+ // />
109
+ // <label htmlFor="atomsselectors">
110
+ // {' '}
111
+ // Only Show Atoms and Selectors{' '}
112
+ // </label>
113
+ // </div>
114
+ // </Fragment>
115
+ // )}
116
+ // </div>
112
117
) ;
113
118
}
114
119
0 commit comments