Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@ import timelineData from './data/timeline.json';

import Timeline from './components/Timeline';


class App extends Component {

render() {
console.log(timelineData);

// Customize the code below
const timeLineDataArray = timelineData.events


Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is interesting! Is this creating a <Timeline events={dataArray} /> ?

return (
<div className="App">
<header className="App-header">
<h1 className="App-title">Application title</h1>
</header>
<main className="App-main">

<Timeline events={timeLineDataArray}/>
</main>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this variable name varHoldsTimeEvents, helps me remember that its prob a grouping of timeline events.

</div>
);
Expand Down
15 changes: 12 additions & 3 deletions src/components/Timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,18 @@ import React from 'react';
import './Timeline.css';
import TimelineEvent from './TimelineEvent';

const Timeline = () => {
// Fill in your code here
return;

const Timeline = (props) => {

const timeLineEventsData = props.events.map((user, index) => {
return (<TimelineEvent key= {index} name={user.person} status={user.status} timeStamp={user.timeStamp}/>)
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this key = {index} prop get used in TimelineEvent?


return (
<section className="timeline">
{timeLineEventsData}
</section>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

varHoldsData I keep having to look at where this is declared to remember what data it holds.

)
}

export default Timeline;
1 change: 1 addition & 0 deletions src/components/TimelineEvent.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

.event-status {
grid-area: 2 / 1 / span 1 / -1;
word-break: break-all;
}

.event-time {
Expand Down
12 changes: 9 additions & 3 deletions src/components/TimelineEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ import React from 'react';
import './TimelineEvent.css';
import Timestamp from './Timestamp';

const TimelineEvent = () => {
// Fill in your code here
return;
const TimelineEvent = (props) => {

return(
<section className="timeline-event">
<h3 className="event-person">{props.name}</h3>
<p className="event-status">{props.status}</p>
<Timestamp time={props.timeStamp}/>
</section>
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good! nice JSX!

}

export default TimelineEvent;
2 changes: 1 addition & 1 deletion src/components/Timestamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const Timestamp = (props) => {
const relative = time.fromNow();

return (
<span title={absolute}>{relative}</span>
<span className="event-time" title={absolute}>{relative}</span>
);
};

Expand Down