Skip to content

Commit 4e325be

Browse files
committed
Set styles defaultProps on component-level
1 parent e579551 commit 4e325be

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

src/Link/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ export default class Link extends React.PureComponent {
6666
}
6767
}
6868

69+
Link.defaultProps = {
70+
styles: {},
71+
};
72+
6973
Link.propTypes = {
7074
linkData: PropTypes.object.isRequired,
7175
orientation: PropTypes.oneOf([
@@ -77,5 +81,5 @@ Link.propTypes = {
7781
'elbow',
7882
]).isRequired,
7983
transitionDuration: PropTypes.number.isRequired,
80-
styles: PropTypes.object.isRequired,
84+
styles: PropTypes.object,
8185
};

src/Node/index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,18 @@ export default class Node extends React.Component {
116116
Node.defaultProps = {
117117
textAnchor: 'start',
118118
attributes: undefined,
119+
styles: {
120+
node: {
121+
circle: {},
122+
name: {},
123+
attributes: {},
124+
},
125+
leafNode: {
126+
circle: {},
127+
name: {},
128+
attributes: {},
129+
},
130+
},
119131
};
120132

121133
Node.propTypes = {
@@ -130,5 +142,5 @@ Node.propTypes = {
130142
attributes: PropTypes.object,
131143
textAnchor: PropTypes.string,
132144
circleRadius: PropTypes.number.isRequired,
133-
styles: PropTypes.object.isRequired,
145+
styles: PropTypes.object,
134146
};

src/Tree/index.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -325,21 +325,7 @@ Tree.defaultProps = {
325325
nodeSize: { x: 140, y: 140 },
326326
separation: { siblings: 1, nonSiblings: 2 },
327327
circleRadius: 10,
328-
styles: {
329-
nodes: {
330-
node: {
331-
circle: {},
332-
name: {},
333-
attributes: {},
334-
},
335-
leafNode: {
336-
circle: {},
337-
name: {},
338-
attributes: {},
339-
},
340-
},
341-
links: {},
342-
},
328+
styles: {},
343329
};
344330

345331
Tree.propTypes = {

0 commit comments

Comments
 (0)