Skip to content

Commit 5e157f1

Browse files
committed
props state to example component
1 parent 67019d2 commit 5e157f1

File tree

3 files changed

+264
-37
lines changed

3 files changed

+264
-37
lines changed

package-lock.json

Lines changed: 229 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/components/Example.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { pointRadial } from 'd3-shape';
66
import useForceUpdate from './useForceUpdate';
77
import LinkControls from './LinkControls';
88
import getLinkComponent from './getLinkComponent';
9-
import { chartDefaultProps } from 'react-google-charts/dist/default-props';
109

1110
interface TreeNode {
1211
name: string;
@@ -61,13 +60,16 @@ export type LinkTypesProps = {
6160
width: number;
6261
height: number;
6362
margin?: { top: number; right: number; bottom: number; left: number };
63+
snapshots: any;
6464
};
6565

6666
export default function Example({
6767
width: totalWidth,
6868
height: totalHeight,
6969
margin = defaultMargin,
70+
snapshots: snapshots,
7071
}: LinkTypesProps) {
72+
console.log('snapshots passed in', snapshots);
7173
const [layout, setLayout] = useState<string>('cartesian');
7274
const [orientation, setOrientation] = useState<string>('horizontal');
7375
const [linkType, setLinkType] = useState<string>('diagonal');
@@ -114,8 +116,8 @@ export default function Example({
114116
setStepPercent={setStepPercent}
115117
/>
116118
<svg width={totalWidth} height={totalHeight}>
117-
<LinearGradient id='links-gradient' from='#fd9b93' to='#fe6e9e' />
118-
<rect width={totalWidth} height={totalHeight} rx={14} fill='#242529' />
119+
<LinearGradient id="links-gradient" from="#fd9b93" to="#fe6e9e" />
120+
<rect width={totalWidth} height={totalHeight} rx={14} fill="#242529" />
119121
<Group top={margin.top} left={margin.left}>
120122
<Tree
121123
root={hierarchy(data, (d) => (d.isExpanded ? null : d.children))}
@@ -129,9 +131,9 @@ export default function Example({
129131
key={i}
130132
data={link}
131133
percent={stepPercent}
132-
stroke='rgb(254,110,158,0.6)'
133-
strokeWidth='1'
134-
fill='none'
134+
stroke="rgb(254,110,158,0.6)"
135+
strokeWidth="1"
136+
fill="none"
135137
/>
136138
))}
137139

@@ -172,7 +174,7 @@ export default function Example({
172174
width={width}
173175
y={-height / 2}
174176
x={-width / 2}
175-
fill='#272b4d'
177+
fill="#272b4d"
176178
stroke={node.data.children ? '#03c0dc' : '#26deb0'}
177179
strokeWidth={1}
178180
strokeDasharray={node.data.children ? '0' : '2,2'}
@@ -186,10 +188,10 @@ export default function Example({
186188
/>
187189
)}
188190
<text
189-
dy='.33em'
191+
dy=".33em"
190192
fontSize={9}
191-
fontFamily='Arial'
192-
textAnchor='middle'
193+
fontFamily="Arial"
194+
textAnchor="middle"
193195
style={{ pointerEvents: 'none' }}
194196
fill={
195197
node.depth === 0

0 commit comments

Comments
 (0)