Skip to content

Commit d96d5a9

Browse files
committed
history nodes styled, working on state properties that are objects
1 parent 882823f commit d96d5a9

File tree

3 files changed

+32
-92
lines changed

3 files changed

+32
-92
lines changed

src/app/components/StateRoute/History.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const defaultMargin: DefaultMargin = {
2121
};
2222

2323
// Fixed node separation distances
24-
const FIXED_NODE_HEIGHT = 120; // Vertical distance between nodes
24+
const FIXED_NODE_HEIGHT = 200; // Vertical distance between nodes
2525
const FIXED_NODE_WIDTH = 220; // Horizontal distance between nodes
2626

2727
// main function exported to StateRoute
@@ -212,8 +212,8 @@ function History(props: Record<string, unknown>): JSX.Element {
212212
// Add rectangles for nodes with consistent size
213213
node
214214
.append('rect')
215-
.attr('width', 180)
216-
.attr('height', 80)
215+
.attr('width', 250)
216+
.attr('height', 120)
217217
.attr('x', -90)
218218
.attr('y', -40)
219219
.attr('rx', 8)
@@ -232,12 +232,11 @@ function History(props: Record<string, unknown>): JSX.Element {
232232
.append('foreignObject')
233233
.attr('x', -85)
234234
.attr('y', -15)
235-
.attr('width', 170)
236-
.attr('height', 65)
235+
.attr('width', 250)
236+
.attr('height', 200)
237237
.append('xhtml:div')
238238
.style('font-size', '12px')
239-
.style('overflow-y', 'auto')
240-
.style('text-align', 'center')
239+
.style('text-align', 'left')
241240
.html((d) => findDiff(d.data.index));
242241

243242
return svg.node();

src/app/styles/components/d3graph.css

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@
1010
.node rect {
1111
fill: #ffffff;
1212
stroke: #e5e7eb;
13-
stroke-width: 2px;
13+
stroke-width: 1px;
1414
transition: all 200ms ease;
1515
}
1616

1717
.node:hover rect {
1818
stroke: #14b8a6;
19+
stroke-width: 2px;
1920
filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
2021
}
2122

@@ -35,6 +36,7 @@
3536

3637
.node--internal:hover rect {
3738
stroke: #14b8a6;
39+
stroke-width: 2px;
3840
}
3941
.node--internal text {
4042
font-family: 'Outfit', sans-serif;
@@ -46,6 +48,7 @@
4648
/* Current/active node styling */
4749
.node.active rect {
4850
stroke: #14b8a6;
51+
stroke-width: 2px;
4952
}
5053

5154
/* Link styling */

src/app/styles/components/diff.css

Lines changed: 22 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,149 +1,87 @@
11
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@100;200;300;400;500;600;700;800;900&display=swap');
22
.jsondiffpatch-delta {
33
font-family: 'Outfit', sans-serif;
4-
font-size: 12px;
4+
font-size: 14px;
55
margin: 0;
6+
padding: 0;
67
display: inline-block;
78
}
89
.jsondiffpatch-delta pre {
910
font-family: 'Outfit', sans-serif;
10-
font-size: 16px;
11+
font-size: 14px;
1112
margin: 0;
1213
padding: 0;
1314
display: inline-block;
1415
}
1516
ul.jsondiffpatch-delta {
1617
list-style-type: none;
17-
padding: 0 0 0 20px;
18+
padding: 0 0 0 12px;
1819
margin: 0;
1920
}
2021
.jsondiffpatch-delta ul {
2122
list-style-type: none;
22-
padding: 0 0 0 20px;
23+
padding: 0 0 0 12px;
2324
margin: 0;
2425
}
26+
2527
.jsondiffpatch-added .jsondiffpatch-property-name,
2628
.jsondiffpatch-added .jsondiffpatch-value pre,
2729
.jsondiffpatch-modified .jsondiffpatch-right-value pre,
2830
.jsondiffpatch-textdiff-added {
29-
background: #5a6c46;
31+
color: #14b8a6;
3032
}
3133
.jsondiffpatch-deleted .jsondiffpatch-property-name,
3234
.jsondiffpatch-deleted pre,
3335
.jsondiffpatch-modified .jsondiffpatch-left-value pre,
3436
.jsondiffpatch-textdiff-deleted {
35-
background: #fccdda;
3637
text-decoration: line-through;
38+
color: #dc2626;
3739
}
38-
.jsondiffpatch-unchanged,
39-
.jsondiffpatch-movedestination {
40-
color: #81929e;
41-
}
42-
.jsondiffpatch-unchanged,
43-
.jsondiffpatch-movedestination > .jsondiffpatch-value {
44-
transition: all 0.5s;
45-
-webkit-transition: all 0.5s;
46-
overflow-y: hidden;
47-
}
48-
.jsondiffpatch-unchanged-showing .jsondiffpatch-unchanged,
49-
.jsondiffpatch-unchanged-showing .jsondiffpatch-movedestination > .jsondiffpatch-value {
50-
max-height: 100px;
51-
}
52-
.jsondiffpatch-unchanged-hidden .jsondiffpatch-unchanged,
53-
.jsondiffpatch-unchanged-hidden .jsondiffpatch-movedestination > .jsondiffpatch-value {
54-
max-height: 0;
55-
}
56-
.jsondiffpatch-unchanged-hiding .jsondiffpatch-movedestination > .jsondiffpatch-value,
57-
.jsondiffpatch-unchanged-hidden .jsondiffpatch-movedestination > .jsondiffpatch-value {
58-
display: block;
59-
}
60-
.jsondiffpatch-unchanged-visible .jsondiffpatch-unchanged,
61-
.jsondiffpatch-unchanged-visible .jsondiffpatch-movedestination > .jsondiffpatch-value {
62-
max-height: 100px;
63-
}
64-
.jsondiffpatch-unchanged-hiding .jsondiffpatch-unchanged,
65-
.jsondiffpatch-unchanged-hiding .jsondiffpatch-movedestination > .jsondiffpatch-value {
66-
max-height: 0;
67-
}
68-
.jsondiffpatch-unchanged-showing .jsondiffpatch-arrow,
69-
.jsondiffpatch-unchanged-hiding .jsondiffpatch-arrow {
70-
display: none;
71-
}
40+
7241
.jsondiffpatch-value {
7342
display: inline-block;
7443
}
7544
.jsondiffpatch-property-name {
7645
display: inline-block;
77-
padding-right: 5px;
78-
vertical-align: top;
46+
padding-right: 4px;
7947
}
48+
8049
.jsondiffpatch-property-name:after {
8150
content: ': ';
8251
}
83-
.jsondiffpatch-child-node-type-array > .jsondiffpatch-property-name:after {
84-
content: ': [';
85-
}
86-
.jsondiffpatch-child-node-type-array:after {
87-
content: '],';
88-
}
89-
div.jsondiffpatch-child-node-type-array:before {
90-
content: '[';
91-
}
92-
div.jsondiffpatch-child-node-type-array:after {
93-
content: ']';
94-
}
95-
.jsondiffpatch-child-node-type-object > .jsondiffpatch-property-name:after {
96-
content: ': {';
97-
}
98-
.jsondiffpatch-child-node-type-object:after {
99-
content: '},';
100-
}
101-
div.jsondiffpatch-child-node-type-object:before {
102-
content: '{';
103-
}
104-
div.jsondiffpatch-child-node-type-object:after {
105-
content: '}';
106-
}
107-
.jsondiffpatch-value pre:after {
108-
content: ',';
109-
}
52+
11053
li:last-child > .jsondiffpatch-value pre:after,
11154
.jsondiffpatch-modified > .jsondiffpatch-left-value pre:after {
11255
content: '';
11356
}
57+
11458
.jsondiffpatch-modified .jsondiffpatch-value {
11559
display: inline-block;
11660
}
61+
11762
.jsondiffpatch-modified .jsondiffpatch-right-value {
118-
margin-left: 5px;
119-
}
120-
.jsondiffpatch-moved .jsondiffpatch-value {
121-
display: none;
63+
margin-left: 6px;
12264
}
65+
12366
.jsondiffpatch-moved .jsondiffpatch-moved-destination {
12467
display: inline-block;
125-
background: #ffffbb;
126-
color: #888;
68+
color: #ffffbb;
12769
}
70+
12871
.jsondiffpatch-moved .jsondiffpatch-moved-destination:before {
12972
content: ' => ';
13073
}
131-
ul.jsondiffpatch-textdiff {
132-
padding: 0;
133-
}
74+
13475
.jsondiffpatch-textdiff-location {
135-
color: #bbb;
76+
color: #ffffbb;
13677
display: inline-block;
13778
min-width: 60px;
13879
}
80+
13981
.jsondiffpatch-textdiff-line {
14082
display: inline-block;
14183
}
84+
14285
.jsondiffpatch-textdiff-line-number:after {
14386
content: ',';
14487
}
145-
.jsondiffpatch-error {
146-
background: red;
147-
color: white;
148-
font-weight: bold;
149-
}

0 commit comments

Comments
 (0)