Skip to content

Commit 3a065ed

Browse files
authored
Merge pull request #8 from oslabs-beta/everyone45/styling
Everyone45/styling
2 parents 034fa73 + 5a4d38e commit 3a065ed

File tree

3 files changed

+38
-12
lines changed

3 files changed

+38
-12
lines changed

src/app/components/ComponentMap.tsx

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,21 @@ export default function ComponentMap({
121121
const tooltipStyles = {
122122
...defaultStyles,
123123
minWidth: 60,
124+
maxWidth: 300,
124125
backgroundColor: 'rgba(0,0,0,0.9)',
125126
color: 'white',
126127
fontSize: '14px',
127128
lineHeight: '18px',
128129
fontFamily: 'Roboto',
130+
zIndex: 100,
131+
};
132+
133+
const scrollStyle = {
134+
minWidth: '60',
135+
maxWidth: '300',
136+
maxHeight: '100px',
137+
overflowY: 'scroll',
138+
overflowWrap: 'break-word',
129139
};
130140

131141
const formatRenderTime = time => {
@@ -136,6 +146,21 @@ export default function ComponentMap({
136146
//places all nodes into a flat array
137147
const nodeList = [];
138148

149+
const makePropsPretty = data => {
150+
const propsFormat = [];
151+
for (const key in data) {
152+
console.log('this is the key', key);
153+
if (typeof data[key] === 'object') {
154+
const nestedObj = makePropsPretty(data[key]);
155+
}
156+
propsFormat.push(<p>
157+
{`${JSON.stringify(key)}: ${JSON.stringify(nestedObj || data[key])}`}
158+
</p>);
159+
}
160+
console.log('this is propsFormat', propsFormat);
161+
return propsFormat;
162+
};
163+
139164
const collectNodes = (node) => {
140165
nodeList.splice(0, nodeList.length);
141166
console.log("Root node:", node);
@@ -342,23 +367,26 @@ export default function ComponentMap({
342367
<strong>{tooltipData.name}</strong>
343368
{' '}
344369
</div>
345-
<div>
346-
State:
347-
{tooltipData.state}
348-
</div>
349-
<div>
350-
Props:
351-
{JSON.stringify(tooltipData.componentData.props)}
352-
</div>
353370
<div>
354371
{' '}
355372
Render time:
356373
{' '}
357374
{formatRenderTime(tooltipData.componentData.actualDuration)}
358375
{' '}
359376
</div>
377+
<div>
378+
State:
379+
{tooltipData.state}
380+
</div>
381+
<div style={scrollStyle}>
382+
Props:
383+
{makePropsPretty(tooltipData.componentData.props)}
384+
{/* {JSON.stringify(tooltipData.componentData.props)} */}
385+
</div>
360386
</div>
361387
</TooltipInPortal>
388+
389+
362390
)}
363391
</div>
364392
);

src/backend/linkFiber.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ function createTree(
474474
const lastClass = currentFiber.child.stateNode.classList[
475475
currentFiber.child.stateNode.classList.length - 1
476476
];
477-
if (lastClass.includes('fromLinkFiber')) {
477+
if (typeof lastClass[lastClass.length - 1] === 'string') {
478478
currentFiber.child.stateNode.classList.remove(lastClass);
479479
}
480480
}

src/backend/tree.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { createGenerateClassName } from "@material-ui/styles";
1111

1212
let copyInstances = 0;
1313
const circularComponentTable = new Set<Tree>();
14-
let componentNames = {}
14+
let componentNames = {};
1515

1616
// Removes unserializable state data such as functions
1717
function scrubUnserializableMembers(tree: Tree): Tree {
@@ -103,7 +103,6 @@ class Tree {
103103
addChild(state: string | {}, name: string, componentData: {}, rtid: any, recoilDomNode: any): Tree {
104104
const uniqueName = this.checkForDuplicates(name);
105105
console.log("ChildName:", uniqueName);
106-
this.name = uniqueName;
107106
const newChild: Tree = new Tree(state, uniqueName, componentData, rtid, recoilDomNode);
108107
newChild.parent = this;
109108
this.children.push(newChild);
@@ -113,7 +112,6 @@ class Tree {
113112
addSibling(state: string | {}, name: string, componentData: {}, rtid: any, recoilDomNode: any): Tree {
114113
const uniqueName = this.checkForDuplicates(name);
115114
console.log("SiblingName:", uniqueName);
116-
this.name = uniqueName;
117115
const newSibling: Tree = new Tree(state, uniqueName, componentData, rtid, recoilDomNode);
118116
newSibling.parent = this.parent;
119117
this.parent.children.push(newSibling);

0 commit comments

Comments
 (0)