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

Space - Chelsea #26

Open
wants to merge 3 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
2 changes: 1 addition & 1 deletion src/App.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.App-header {
background-color: #222;
background-color: rgb(4, 124, 54);
padding-bottom: 0.5rem;
color: white;
position: fixed;
Expand Down
9 changes: 5 additions & 4 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import React from 'react';
import logo from './logo.svg';
import './App.css';
import timelineData from './data/timeline.json';
import timeline from './data/timeline.json';
import Timeline from './components/Timeline';


function App() {
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">Look! Here is the title!</h1>
</header>
<main className="App-main">

<Timeline events={timeline.events}/>
</main>
</div>
);
Expand Down
20 changes: 17 additions & 3 deletions src/components/Timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,23 @@ import React from 'react';
import './Timeline.css';
import TimelineEvent from './TimelineEvent';

const Timeline = () => {

return;
const Timeline = (events) => {
const allPosts = events.events.map((post) => {
return (
<TimelineEvent
person={post.person}
status={post.status}
timeStamp={post.timeStamp}
key={post.timeStamp + post.person}
/>
);
});

return(
<ul className="PostCollection">
{allPosts}
</ul>
);
}

export default Timeline;
1 change: 1 addition & 0 deletions src/components/TimelineEvent.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
grid-area: 1 / 1 / span 1 / span 1;
margin-top: 0.5rem;
font-weight: bolder;
color: green;
}

.event-status {
Expand Down
12 changes: 9 additions & 3 deletions src/components/TimelineEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ import React from 'react';
import './TimelineEvent.css';
import Timestamp from './Timestamp';

const TimelineEvent = () => {

return;
const TimelineEvent = (props) => {

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

export default TimelineEvent;
3 changes: 3 additions & 0 deletions src/components/Timestamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ const Timestamp = (props) => {
const absolute = time.format('MMMM Do YYYY, h:mm:ss a');
const relative = time.fromNow();


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

Expand Down