diff --git a/README.md b/README.md index 9a36011..82c644a 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,9 @@ Add extra class name to root div element. Choose if you want `'1-column-left'` or `'1-column-right'` or `'2-columns'` (default: `'2-columns'`). +### `lineColor={ String }` + +Choose a color for the timeline (default: `'white'`). ## VerticalTimelineElement Props diff --git a/src/VerticalTimeline.css b/src/VerticalTimeline.css index 04b7a7d..10bc0d5 100644 --- a/src/VerticalTimeline.css +++ b/src/VerticalTimeline.css @@ -24,7 +24,7 @@ left: 18px; height: 100%; width: 4px; - background: white; + background: var(--line-color); } .vertical-timeline.vertical-timeline--one-column-right::before { diff --git a/src/VerticalTimeline.js b/src/VerticalTimeline.js index 5bbef44..b679f38 100644 --- a/src/VerticalTimeline.js +++ b/src/VerticalTimeline.js @@ -2,19 +2,28 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; -const VerticalTimeline = ({ animate, className, layout, children }) => ( -
- {children} -
-); +const VerticalTimeline = ({ + animate, + className, + layout, + lineColor, + children, +}) => { + document.documentElement.style.setProperty('--line-color', lineColor); + return ( +
+ {children} +
+ ); +}; VerticalTimeline.propTypes = { children: PropTypes.oneOfType([ @@ -29,12 +38,14 @@ VerticalTimeline.propTypes = { '2-columns', '1-column-right', ]), + lineColor: PropTypes.string, }; VerticalTimeline.defaultProps = { animate: true, className: '', layout: '2-columns', + lineColor: '#FFF', }; export default VerticalTimeline;