-
Notifications
You must be signed in to change notification settings - Fork 44
Ports - Jessica #7
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,18 +3,25 @@ import './App.css'; | |
| import timelineData from './data/timeline.json'; | ||
|
|
||
| import Timeline from './components/Timeline'; | ||
| // import TimelineEvent from './components/TimelineEvent'; //temp | ||
|
|
||
|
|
||
| class App extends Component { | ||
|
|
||
| render() { | ||
| console.log(timelineData); | ||
| const eventObjects = timelineData.events.map((event, i) => { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like you are not using 'i' in this block. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you take a look at the JSON, you will see that there is an Events key which is the array of statuses. Both seem to work. :) |
||
| return event; | ||
| }); | ||
| console.log(eventObjects); | ||
|
|
||
| // Customize the code below | ||
| return ( | ||
| <div className="App"> | ||
| <header className="App-header"> | ||
| <h1 className="App-title">Application title</h1> | ||
| <h1 className="App-title">Soash Meeds</h1> | ||
| </header> | ||
| <main className="App-main"> | ||
| <Timeline events={eventObjects} /> | ||
| </main> | ||
| </div> | ||
| ); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,23 @@ | ||
| import React from 'react'; | ||
| import './Timeline.css'; | ||
| import TimelineEvent from './TimelineEvent'; | ||
| // testing | ||
| const Timeline = (props) => { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very clean. Looks like you are not using 'i' in this block. You may want to consider using it as a key. |
||
| const eventComponents = props.events.map((event, i) => { | ||
| return ( | ||
| <TimelineEvent | ||
| person={event.person} | ||
| status={event.status} | ||
| timestamp={event.timeStamp} /> | ||
| ); | ||
| }); | ||
|
|
||
| const Timeline = () => { | ||
| // Fill in your code here | ||
| return; | ||
| return ( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Super clean return! |
||
| <section class="timeline"> | ||
| {eventComponents} | ||
| </section> | ||
| ); | ||
| } | ||
|
|
||
| export default Timeline; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,9 +2,14 @@ import React from 'react'; | |
| import './TimelineEvent.css'; | ||
| import Timestamp from './Timestamp'; | ||
|
|
||
| const TimelineEvent = () => { | ||
| // Fill in your code here | ||
| return; | ||
| const TimelineEvent = (props) => { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Beautiful. Good use of classes. Would this be a place to use className instead of class? |
||
| return ( | ||
| <section class="timeline-event"> | ||
| <h4 class="event-person">{props.person}</h4> | ||
| <p class="event-status">{props.status}</p> | ||
| <p class="event-time"><Timestamp time={props.timestamp} /></p> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It appears that this is not actually working. The date stamps would be something like a year ago (I ran into this problem too). Consider taking a look at the JSON file. The key for timeStamp has a capital 's'. I would play around with this to see if you can see the timestamp based off of the dates in the JSON file. :) |
||
| </section> | ||
| ); | ||
| } | ||
|
|
||
| export default TimelineEvent; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice use of a variable to make the code in your return clean.