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
5 changes: 2 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@ import './App.css';
import timelineData from './data/timeline.json';

import Timeline from './components/Timeline';

class App extends Component {
render() {
console.log(timelineData);

// Customize the code below
return (
<div className="App">
<header className="App-header">
<h1 className="App-title">Application title</h1>
<h1 className="App-title">Ada Lovelace's Feed</h1>
</header>
<main className="App-main">
<Timeline events= {timelineData["events"]} />
</main>
</div>
);
Expand Down
22 changes: 18 additions & 4 deletions src/components/Timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,23 @@ import React from 'react';
import './Timeline.css';
import TimelineEvent from './TimelineEvent';

const Timeline = () => {
// Fill in your code here
return;
}
const Timeline = (props) => {
const posts = props.events.map((event, i) => {
return (
<section key={ i }>
<TimelineEvent
person={ event.person }
status={ event.status }
timestamp={ event.timeStamp } />
</section>
);
});

return (
<section className="post">
{ posts }
</section>
);
};

export default Timeline;
25 changes: 21 additions & 4 deletions src/components/TimelineEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,26 @@ import React from 'react';
import './TimelineEvent.css';
import Timestamp from './Timestamp';

const TimelineEvent = () => {
// Fill in your code here
return;
}
const personTimestamp = (props) => {
return (
<Timestamp time={ props } />
);
};

const TimelineEvent = (props) => {
return (
<section>
<h3>
Person: { props.person }
</h3>
<p>
Status: { props.status}
</p>
<p>
Timestamp: { personTimestamp(props.timeStamp) }
</p>
</section>
);
};

export default TimelineEvent;