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
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"workbench.colorCustomizations": {
"tab.unfocusedActiveBorder": "#fff0"
}
}
32 changes: 14 additions & 18 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
import React, { Component } from 'react';
import React 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 (
<div className="App">
<header className="App-header">
<h1 className="App-title">Application title</h1>
</header>
<main className="App-main">
</main>
</div>
);
}
}
const App = () => {
console.log(timelineData);
return (
<div className="App">
<header className="App-header">
<h1 className="App-title">{timelineData.person}'s Timeline</h1>
</header>
<main className="App-main">
<Timeline events={timelineData.events} />
</main>
</div>
);
};

export default App;
2 changes: 1 addition & 1 deletion src/components/Timeline.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.timeline {
width: 30%;
width: 60%;
margin: auto;
text-align: left;
}
17 changes: 13 additions & 4 deletions src/components/Timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,18 @@ import React from 'react';
import './Timeline.css';
import TimelineEvent from './TimelineEvent';

const Timeline = () => {
// Fill in your code here
return;
}
const Timeline = props => {
const eventFeed = props.events.map((event, i) => {
return (
<TimelineEvent
key={i}
person={event.person}
Copy link

Choose a reason for hiding this comment

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

also very clean!

status={event.status}
time={event.timeStamp}
/>
);
});

return <section className="timeline">{eventFeed}</section>;
Copy link

Choose a reason for hiding this comment

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

good use of className!

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

const TimelineEvent = () => {
// Fill in your code here
return;
}
const TimelineEvent = props => {
return (
<article className="timeline-event">
<p className="event-person">{props.person}</p>
<p className="event-status">{props.status}</p>
<p className="event-time">
Copy link

Choose a reason for hiding this comment

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

very clean!

<Timestamp time={props.time} />
</p>
</article>
);
};

export default TimelineEvent;
6 changes: 2 additions & 4 deletions src/components/Timestamp.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import React from 'react';
import moment from 'moment';

const Timestamp = (props) => {
const Timestamp = props => {
const time = moment(props.time);
const absolute = time.format('MMMM Do YYYY, h:mm:ss a');
const relative = time.fromNow();

return (
<span title={absolute}>{relative}</span>
);
return <span title={absolute}>{relative}</span>;
};

export default Timestamp;
4 changes: 3 additions & 1 deletion src/index.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@import url('https://fonts.googleapis.com/css?family=Courgette|Open+Sans&display=swap');

body {
margin: 0;
padding: 0;
font-family: 'Muli', sans-serif;
font-family: 'Courgette', sans-serif;
}