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 - Laneia #10

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 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: 3 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ class App extends Component {
return (
<div className="App">
<header className="App-header">
<h1 className="App-title">Application title</h1>
<h1 className="App-title">Timeline</h1>
</header>
<main className="App-main">
<Timeline />
</main>

</div>
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/Timeline.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.timeline {
width: 30%;
width: 50%;
margin: auto;
text-align: left;
font-size: 1.5rem;
}
22 changes: 19 additions & 3 deletions src/components/Timeline.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
import React from 'react';
import './Timeline.css';
import TimelineEvent from './TimelineEvent';
import data from '../data/timeline.json';

const Timeline = () => {
// Fill in your code here
return;
}
render() {
const events = data.events;

const timelineEventComponents = events.map((event) => {
return (
<TimelineEvent
key={event.timeStamp}
person={event.person}
status={event.status}
timeStamp={event.timeStamp}
/>
);
});

return (
<div className="timeline">{timelineEventComponents}</div>
);
}}

export default Timeline;
19 changes: 16 additions & 3 deletions src/components/TimelineEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,21 @@ import './TimelineEvent.css';
import Timestamp from './Timestamp';

const TimelineEvent = () => {

Choose a reason for hiding this comment

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

I think props should be a parameter in TimelineEvent to call the data for person, status and timeStamp.

// Fill in your code here
return;
}
render() {
const person = this.props.person;
const timeStamp = this.props.timeStamp;
const status = this.props.status;


return (
<section className="timeline">
<p className="event-person">{person}</p>
<Timestamp
time={timeStamp}
/>
<p className="event-status">{status}</p>
</section>
);
}}

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