Skip to content

Commit 5cda6fe

Browse files
committed
added scroll bar for history nodes
1 parent d96d5a9 commit 5cda6fe

File tree

3 files changed

+37
-6
lines changed

3 files changed

+37
-6
lines changed

src/app/components/StateRoute/History.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ function History(props: Record<string, unknown>): JSX.Element {
212212
// Add rectangles for nodes with consistent size
213213
node
214214
.append('rect')
215-
.attr('width', 250)
215+
.attr('width', 200)
216216
.attr('height', 120)
217217
.attr('x', -90)
218218
.attr('y', -40)
@@ -222,7 +222,7 @@ function History(props: Record<string, unknown>): JSX.Element {
222222
// Add snapshot titles
223223
node
224224
.append('text')
225-
.attr('dy', '-25')
225+
.attr('dy', '-20')
226226
.attr('text-anchor', 'middle')
227227
.attr('class', 'snapshot-title')
228228
.text((d) => `Snapshot ${d.data.index + 1}`);
@@ -232,11 +232,12 @@ function History(props: Record<string, unknown>): JSX.Element {
232232
.append('foreignObject')
233233
.attr('x', -85)
234234
.attr('y', -15)
235-
.attr('width', 250)
236-
.attr('height', 200)
235+
.attr('width', 170)
236+
.attr('height', 90)
237237
.append('xhtml:div')
238238
.style('font-size', '12px')
239239
.style('text-align', 'left')
240+
.style('padding-left', '12px')
240241
.html((d) => findDiff(d.data.index));
241242

242243
return svg.node();

src/app/styles/components/d3graph.css

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
stroke: #14b8a6;
3939
stroke-width: 2px;
4040
}
41+
4142
.node--internal text {
4243
font-family: 'Outfit', sans-serif;
4344
font-size: 14px;
@@ -95,3 +96,32 @@ div.tooltip {
9596
overflow: auto; /* Enable scrolling */
9697
position: relative; /* Create new stacking context */
9798
}
99+
100+
/* State changes text container styling */
101+
.node foreignObject div {
102+
max-height: 100%; /* Fixed height for scroll container */
103+
overflow-y: scroll;
104+
overflow-x: hidden;
105+
scrollbar-width: thin;
106+
padding-right: 6px;
107+
scrollbar-color: #cbd5e1 #f1f5f9;
108+
}
109+
110+
/* Custom scrollbar styling for Webkit browsers */
111+
.node foreignObject div::-webkit-scrollbar {
112+
width: 6px;
113+
}
114+
115+
.node foreignObject div::-webkit-scrollbar-track {
116+
background: #f1f5f9;
117+
border-radius: 3px;
118+
}
119+
120+
.node foreignObject div::-webkit-scrollbar-thumb {
121+
background: #cbd5e1;
122+
border-radius: 3px;
123+
}
124+
125+
.node foreignObject div::-webkit-scrollbar-thumb:hover {
126+
background: #94a3b8;
127+
}

src/app/styles/components/diff.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
}
1616
ul.jsondiffpatch-delta {
1717
list-style-type: none;
18-
padding: 0 0 0 12px;
18+
padding: 0;
1919
margin: 0;
2020
}
2121
.jsondiffpatch-delta ul {
2222
list-style-type: none;
23-
padding: 0 0 0 12px;
23+
padding: 0;
2424
margin: 0;
2525
}
2626

0 commit comments

Comments
 (0)