|
| 1 | +#### [View components](./js/components/timeline) |
| 2 | + |
| 3 | +## List of widgets |
| 4 | + |
| 5 | + |
| 6 | +### - [Timeline](./js/components/timeline/timeline.js) |
| 7 | + |
| 8 | +The parent component which renders the entire timeline. |
| 9 | + |
| 10 | +#### Usage: |
| 11 | + |
| 12 | +You have 2 choices - you may either pass data for rendering the timeline via props, or you can pass components [Timelabel](./js/components/timeline/time-label.js) and [TimelineItem](./js/components/timeline/timeline-item/timeline-item.js) as children to Timeline. |
| 13 | + |
| 14 | +Props: Timeline components takes `timelineInfo`, an array of objects. Each object is of the following structure - |
| 15 | + |
| 16 | +```javascript |
| 17 | + |
| 18 | +startDate: '10 Feb. 2014' (Beginning of one element in the timeline), |
| 19 | +endDate: '3 Jan. 2014' (End time of the element in the timeline), |
| 20 | +items: Array of objects containing data to be rendered for each individual element in the timeline |
| 21 | +[ |
| 22 | + { |
| 23 | + icon: 'fa fa-envelope' (Any font-awesome icon as a marker for the timeline element), |
| 24 | + iconTheme: 'bg-blue' (Color of the marker), |
| 25 | + time: ' 12:05' (Date/Time for the element), |
| 26 | + |
| 27 | + //For each of the option below, you can pass html elements or other component widgets as `markup` to render in each of the sections |
| 28 | + header: (Header section of the item) { |
| 29 | + url: '#', |
| 30 | + title: 'Support Team ', |
| 31 | + content: 'sent you an email' |
| 32 | + markup: (Optional, can be used to pass html) |
| 33 | + }, |
| 34 | + body: (Body of the item) { |
| 35 | + content: 'Etsy doostang zoodles disqus groupon greplin oooj voxy zoodles, weebly ning heekya handango imeem plugg dopplr jibjab, movity jajah plickers sifteo edmodo ifttt zimbra. Babblely odeo kaboodle quora plaxo ideeli hulu weebly balihoo...', |
| 36 | + }, |
| 37 | + footer:(Footer section of the item) { |
| 38 | + content: '', |
| 39 | + markup: [ |
| 40 | + <a key="1" className="btn btn-primary btn-xs">Read more</a>, |
| 41 | + <a key="2" className="btn btn-danger btn-xs">Delete</a> |
| 42 | + ] |
| 43 | + } |
| 44 | + } |
| 45 | +] |
| 46 | +``` |
| 47 | + |
| 48 | +#### Example: |
| 49 | + |
| 50 | +```javascript |
| 51 | +var timelineInfo = [ |
| 52 | + { |
| 53 | + startDate: '10 Feb. 2014', |
| 54 | + endDate: '3 Jan. 2014', |
| 55 | + items: [ |
| 56 | + { |
| 57 | + icon: 'fa fa-envelope', |
| 58 | + iconTheme: 'bg-blue', |
| 59 | + time: ' 12:05', |
| 60 | + header: { |
| 61 | + url: '#', |
| 62 | + title: 'Support Team ', |
| 63 | + content: 'sent you an email' |
| 64 | + }, |
| 65 | + body: { |
| 66 | + content: 'Etsy doostang zoodles disqus groupon greplin oooj voxy zoodles, weebly ning heekya handango imeem plugg dopplr jibjab, movity jajah plickers sifteo edmodo ifttt zimbra. Babblely odeo kaboodle quora plaxo ideeli hulu weebly balihoo...', |
| 67 | + }, |
| 68 | + footer: { |
| 69 | + content: '', |
| 70 | + markup: [ |
| 71 | + <a key="1" className="btn btn-primary btn-xs">Read more</a>, |
| 72 | + <a key="2" className="btn btn-danger btn-xs">Delete</a> |
| 73 | + ] |
| 74 | + } |
| 75 | + }, |
| 76 | + { |
| 77 | + icon: 'fa fa-user', |
| 78 | + iconTheme: 'bg-aqua', |
| 79 | + time: ' 5 mins ago', |
| 80 | + header: { |
| 81 | + url: '#', |
| 82 | + title: 'Sarah Young ', |
| 83 | + content: 'accepted your friend request' |
| 84 | + } |
| 85 | + }, |
| 86 | + { |
| 87 | + icon: 'fa fa-comments', |
| 88 | + iconTheme: 'bg-yellow', |
| 89 | + time: ' 27 mins ago', |
| 90 | + header: { |
| 91 | + url: '#', |
| 92 | + title: 'Jay White ', |
| 93 | + content: 'commented on your post' |
| 94 | + }, |
| 95 | + body: { |
| 96 | + content: 'Take me to your leader! Switzerland is small and neutral! We are more like Germany, ambitious and misunderstood!' |
| 97 | + }, |
| 98 | + footer: { |
| 99 | + content: '', |
| 100 | + markup: <a className="btn btn-warning btn-flat btn-xs">View comment</a> |
| 101 | + } |
| 102 | + } |
| 103 | + ] |
| 104 | + },{ |
| 105 | + items: [ |
| 106 | + { |
| 107 | + icon: 'fa fa-camera', |
| 108 | + iconTheme: 'bg-purple', |
| 109 | + time: ' 2 days ago', |
| 110 | + header: { |
| 111 | + url: '#', |
| 112 | + title: 'Mina Lee ', |
| 113 | + content: 'uploaded new photos' |
| 114 | + }, |
| 115 | + body: { |
| 116 | + content: '', |
| 117 | + markup: [ |
| 118 | + <img key="1" src="http://placehold.it/150x100" alt="..." className="margin" />, |
| 119 | + <img key="2" src="http://placehold.it/150x100" alt="..." className="margin" />, |
| 120 | + <img key="3" src="http://placehold.it/150x100" alt="..." className="margin" />, |
| 121 | + <img key="4" src="http://placehold.it/150x100" alt="..." className="margin" /> |
| 122 | + ] |
| 123 | + } |
| 124 | + }, |
| 125 | + { |
| 126 | + icon: 'fa fa-video-camera', |
| 127 | + iconTheme: 'bg-maroon', |
| 128 | + time: ' 5 days ago', |
| 129 | + header: { |
| 130 | + url: '#', |
| 131 | + title: 'Mr. Doe ', |
| 132 | + content: 'shared a video' |
| 133 | + }, |
| 134 | + body: { |
| 135 | + content: '', |
| 136 | + markup: <div className="embed-responsive embed-responsive-16by9"> |
| 137 | + <iframe className="embed-responsive-item" src="https://www.youtube.com/embed/tMWkeBIohBs" frameBorder="0" allowFullScreen=""> |
| 138 | + </iframe> |
| 139 | + </div> |
| 140 | + }, |
| 141 | + footer: { |
| 142 | + content: '', |
| 143 | + markup: <a href="#" className="btn btn-xs bg-maroon">See comments</a> |
| 144 | + } |
| 145 | + } |
| 146 | + ] |
| 147 | + } |
| 148 | +]; |
| 149 | + |
| 150 | +<Timeline timelineInfo={this.state.timelineInfo}/> |
| 151 | +``` |
0 commit comments