Skip to content

Commit

Permalink
fix: Allow time "line" color to be customized
Browse files Browse the repository at this point in the history
  • Loading branch information
rcdexta committed May 21, 2018
1 parent a683147 commit 3fdd610
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions components/Timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import s from './styles'

class Timeline extends Component {
render () {
const { orientation = 'left', children, style = {}, ...otherProps } = this.props
const { orientation = 'left', children, lineColor, style = {}, ...otherProps } = this.props
const childrenWithProps = React.Children.map(children, child => React.cloneElement(child, { orientation }))
const leftOrRight = (orientation === 'right') ? {...s['containerBefore--right']} : {...s['containerBefore--left']}
let leftOrRight = (orientation === 'right') ? {...s['containerBefore--right']} : {...s['containerBefore--left']}
leftOrRight = lineColor ? {...leftOrRight, background: lineColor} : leftOrRight
return (
<div>
<section style={{...s.container, ...style}} {...otherProps}>
Expand All @@ -22,7 +23,8 @@ class Timeline extends Component {
Timeline.propTypes = {
children: PropTypes.node.isRequired,
orientation: PropTypes.string,
style: PropTypes.object
style: PropTypes.object,
lineColor: PropTypes.string
}

export default Timeline
2 changes: 1 addition & 1 deletion stories/App.story.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ storiesOf('Timeline', module)
.add(
'Icon and Bubble Styling',
withInfo('Modify the appearance of bubbles and containing icons')(() =>
<Timeline>
<Timeline lineColor='magenta'>
<TimelineEvent
title='John Doe sent a SMS'
createdAt='2016-09-12 10:06 PM'
Expand Down

0 comments on commit 3fdd610

Please sign in to comment.