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 @@ -2,19 +2,24 @@ import React, { Component } from 'react';
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 (
return(
<div className="App">
<header className="App-header">
<h1 className="App-title">Application title</h1>
<h1 className="App-title">Ada Lovelace's social media feed</h1>
</header>
<main className="App-main">

<Timeline events={timelineData["events"]} />

Choose a reason for hiding this comment

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

Great job reading the data from the JSON file!

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

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

const events = props.events.map((event, i) => {

Choose a reason for hiding this comment

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

Good use of map function!

return (

<TimelineEvent key={i}
person={event.person}
status={event.status}
timestamp={event.timeStamp} />

);
});

return (
<section className="timeline">
{ events }
</section>
);
}

export default Timeline;
24 changes: 21 additions & 3 deletions src/components/TimelineEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,27 @@ 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">

<div className="event-person">
{props.person}
</div>

<div className="event-status">
{props.status}
</div>

<div className="event-time">
<Timestamp time={props.timestamp} />
</div>

</section>

);
}

export default TimelineEvent;