Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ports - Angela #13

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
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
4 changes: 4 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@
padding-top: 7rem;
background-color: #E6ECF0;
}

ul {
list-style: none;
}
16 changes: 12 additions & 4 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
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
const postingData = timelineData.events.map ((post, i) => {

Choose a reason for hiding this comment

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

Great idea to just map in the App component!

return (
<li key={i}>
<Timeline event={ post } />
</li>
)
});

return (
<div className="App">
<header className="App-header">
<h1 className="App-title">Application title</h1>
<h1 className="App-title">React Timeline</h1>
</header>
<main className="App-main">
<ul>
{postingData}
</ul>
</main>
</div>
);
Expand Down
11 changes: 8 additions & 3 deletions src/components/Timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@ import React from 'react';
import './Timeline.css';
import TimelineEvent from './TimelineEvent';

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

const Timeline = (props) => {

return(

Choose a reason for hiding this comment

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

Very clean and easy to see the flow of the data from timelineData.json

<div className='timeline'>
<TimelineEvent status={props.event.status} person={props.event.person} timeStamp={props.event.timeStamp}/>
</div>
);
}

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

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

const time = <Timestamp time={ props.timeStamp} />

Choose a reason for hiding this comment

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

Good idea to make use of the Timestamp component and saving its return value in a variable


return(
<section className='timeline-event'>
<p className='event-person'>{props.person}</p>
<p className='event-status'>{props.status}</p>
<p className='event-time'>{time}</p>
</section>
);
};

export default TimelineEvent;