diff --git a/src/App.js b/src/App.js index 76d86d2..c8bf10c 100644 --- a/src/App.js +++ b/src/App.js @@ -11,9 +11,10 @@ function App() { return (
-

Application title

+

{timelineData.person}'s Social Media Timeline

+
); diff --git a/src/components/Timeline.css b/src/components/Timeline.css index e31f946..f2ef065 100644 --- a/src/components/Timeline.css +++ b/src/components/Timeline.css @@ -1,5 +1,5 @@ .timeline { width: 30%; - margin: auto; + margin: 10px auto; text-align: left; } diff --git a/src/components/Timeline.js b/src/components/Timeline.js index 463eb3e..327870a 100644 --- a/src/components/Timeline.js +++ b/src/components/Timeline.js @@ -2,9 +2,16 @@ import React from 'react'; import './Timeline.css'; import TimelineEvent from './TimelineEvent'; -const Timeline = () => { - - return; +const Timeline = (props) => { + const timelineComponents = props.events.map((event, i) => { + return ( +
+ +
+ ); + }); + + return (timelineComponents); } export default Timeline; \ No newline at end of file diff --git a/src/components/TimelineEvent.css b/src/components/TimelineEvent.css index ea6407a..a58a779 100644 --- a/src/components/TimelineEvent.css +++ b/src/components/TimelineEvent.css @@ -4,6 +4,7 @@ padding: 0.5rem; border-bottom: 1px solid #E6ECF0; background-color: #FFF; + border-radius: 5px; } .timeline-event:hover { @@ -18,6 +19,7 @@ .event-status { grid-area: 2 / 1 / span 1 / -1; + overflow-wrap: break-word; } .event-time { @@ -25,3 +27,8 @@ margin-top: 0.5rem; text-align: right; } + +.event-likes { + grid-area: 3 / 1 / span 1 / -1; + margin: 5px 0; +} \ No newline at end of file diff --git a/src/components/TimelineEvent.js b/src/components/TimelineEvent.js index cc476c2..a5598c8 100644 --- a/src/components/TimelineEvent.js +++ b/src/components/TimelineEvent.js @@ -2,9 +2,18 @@ import React from 'react'; import './TimelineEvent.css'; import Timestamp from './Timestamp'; -const TimelineEvent = () => { - - return; +const TimelineEvent = (props) => { + let likes = "likes"; + if (props.likes === 1) likes = "like"; + + return ( +
+
{props.person}
+

+

{props.status}

+

{props.likes} {likes}

+
+ ) } export default TimelineEvent; \ No newline at end of file diff --git a/src/data/timeline.json b/src/data/timeline.json index 743c449..cb8ad1c 100644 --- a/src/data/timeline.json +++ b/src/data/timeline.json @@ -4,32 +4,38 @@ { "person": "Adele Goldberg", "status": "In Smalltalk, everything happens somewhere else.", - "timeStamp": "2018-05-18T22:12:03Z" + "timeStamp": "2018-05-18T22:12:03Z", + "likes": 5 }, { "person": "Erica Baker", "status": "Every once in a while, life affords you the opportunity to have real, authentic, genuine happiness. It's up to you to see it. Pay attention.", - "timeStamp": "2018-05-18T22:19:40Z" + "timeStamp": "2018-05-18T22:19:40Z", + "likes": 3 }, { "person": "Aubrey Tang", "status": "The art of computer programming is a blend of mathematics and poetry.", - "timeStamp": "2018-05-18T22:41:19Z" + "timeStamp": "2018-05-18T22:41:19Z", + "likes": 3 }, { "person": "Julia Evans", "status": "no seriously what if we replaced tech books with informative concise 30 page zines though", - "timeStamp": "2018-05-18T23:02:44Z" + "timeStamp": "2018-05-18T23:02:44Z", + "likes": 125 }, { "person": "Stephanie Hurlburt", "status": "I don’t think you can do good work if you’re not at least occasionally talking to a person you’re building for.", - "timeStamp": "2018-05-18T23:09:38Z" + "timeStamp": "2018-05-18T23:09:38Z", + "likes": 1 }, { "person": "Yan Zhu", "status": "//for a good time, paste this into twitter page console: c=new AudioContext;n=setInterval(\"for(n+=7,i=k,P='▲.\\\n';i-=1/k;P+=P[i%2?(i%2*j-j+n/k^j)&1:2])j=k/i;doc.innerHTML=P;with(c.createOscillator())frequency.value=200*(j+n/k^j),connect(c.destination),start(),stop(n/k)\",k=64)", - "timeStamp": "2018-05-18T23:51:01Z" + "timeStamp": "2018-05-18T23:51:01Z", + "likes": 8 } ] } \ No newline at end of file