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 - Amy W #3

Open
wants to merge 5 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
5 changes: 2 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ 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">Code Monkey</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.

I like how neat and simple passing timelineData.events is.

</main>
</div>
);
Expand Down
1 change: 1 addition & 0 deletions src/components/Timeline.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
width: 30%;
margin: auto;
text-align: left;
list-style-type: none;
}
23 changes: 20 additions & 3 deletions src/components/Timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,26 @@ import React from 'react';
import './Timeline.css';
import TimelineEvent from './TimelineEvent';

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

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

Choose a reason for hiding this comment

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

There are some provided CSS classes in TimelineEvent.css (timeline-event, timeline-event:hover, event-person, event-status, event-time) that would auto-style things for you :)

<li key={i}>

Choose a reason for hiding this comment

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

This definitely works, and perhaps is even a better semantic solution, but since the TimelineEvent is a single thing, you could also just return that and not use a ul at all.

<TimelineEvent
person={ event.person }
status={ event.status }
timestamp={ event.timeStamp }/>
</li>
);
});

return (
<section>

Choose a reason for hiding this comment

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

There was a CSS class provided called "timeline" that sets the width to 30%, margin to auto, and text-align left that you could throw in here.

<ul className="timeline">
{ timelineComponents }

Choose a reason for hiding this comment

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

(See above comment -- again, not a fix, just an alternate idea)

</ul>
</section>
);
}

export default Timeline;
17 changes: 14 additions & 3 deletions src/components/TimelineEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,20 @@ 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.person}
</h3>
<p className="event-status">
{props.status}
</p>
<h5 className="event-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.

Nice use of the provided Timestamp component.

</h5>
</section>
);
}

export default TimelineEvent;