Skip to content

Commit 36d2b2c

Browse files
Merge pull request #148 from PatrykBukowski/replace-default-props
Changing defaultProps to default JS parameters
2 parents a4685ca + bc2d59c commit 36d2b2c

File tree

2 files changed

+24
-51
lines changed

2 files changed

+24
-51
lines changed

src/VerticalTimeline.js

+4-11
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import PropTypes from 'prop-types';
33
import classNames from 'classnames';
44

55
const VerticalTimeline = ({
6-
animate,
7-
className,
8-
layout,
9-
lineColor,
6+
animate = true,
7+
className = '',
8+
layout = '2-columns',
9+
lineColor = '#FFF',
1010
children,
1111
}) => {
1212
if (typeof window === 'object') {
@@ -43,11 +43,4 @@ VerticalTimeline.propTypes = {
4343
lineColor: PropTypes.string,
4444
};
4545

46-
VerticalTimeline.defaultProps = {
47-
animate: true,
48-
className: '',
49-
layout: '2-columns',
50-
lineColor: '#FFF',
51-
};
52-
5346
export default VerticalTimeline;

src/VerticalTimelineElement.js

+20-40
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,26 @@ import classNames from 'classnames';
44
import { InView } from 'react-intersection-observer';
55

66
const VerticalTimelineElement = ({
7-
children,
8-
className,
9-
contentArrowStyle,
10-
contentStyle,
11-
date,
12-
dateClassName,
13-
icon,
14-
iconClassName,
15-
iconOnClick,
16-
onTimelineElementClick,
17-
iconStyle,
18-
id,
19-
position,
20-
style,
21-
textClassName,
22-
intersectionObserverProps,
23-
visible,
7+
children = '',
8+
className = '',
9+
contentArrowStyle = null,
10+
contentStyle = null,
11+
date = '',
12+
dateClassName = '',
13+
icon = null,
14+
iconClassName = '',
15+
iconOnClick = null,
16+
onTimelineElementClick = null,
17+
iconStyle = null,
18+
id = '',
19+
position = '',
20+
style = null,
21+
textClassName = '',
22+
intersectionObserverProps = {
23+
rootMargin: '0px 0px -40px 0px',
24+
triggerOnce: true,
25+
},
26+
visible = false,
2427
}) => (
2528
<InView {...intersectionObserverProps}>
2629
{({ inView, ref }) => (
@@ -109,27 +112,4 @@ VerticalTimelineElement.propTypes = {
109112
}),
110113
};
111114

112-
VerticalTimelineElement.defaultProps = {
113-
children: '',
114-
className: '',
115-
contentArrowStyle: null,
116-
contentStyle: null,
117-
icon: null,
118-
iconClassName: '',
119-
iconOnClick: null,
120-
onTimelineElementClick: null,
121-
iconStyle: null,
122-
id: '',
123-
style: null,
124-
date: '',
125-
dateClassName: '',
126-
position: '',
127-
textClassName: '',
128-
visible: false,
129-
intersectionObserverProps: {
130-
rootMargin: '0px 0px -40px 0px',
131-
triggerOnce: true,
132-
},
133-
};
134-
135115
export default VerticalTimelineElement;

0 commit comments

Comments
 (0)