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

Time - Jocelyn #35

Open
wants to merge 6 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
11 changes: 4 additions & 7 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
import React from 'react';
import logo from './logo.svg';
import './App.css';
import timelineData from './data/timeline.json';
import Timeline from './components/Timeline';

function App() {
console.log(timelineData);

// Customize the code below
return (
<div className="App">
<section className="App">
<header className="App-header">
<h1 className="App-title">Application title</h1>
<h1 className="App-title">{`${timelineData.person}'s Social Media Feed`}</h1>
</header>
<main className="App-main">
<Timeline events={timelineData.events}/>
</main>
</div>
</section>
);
}

Expand Down
4 changes: 3 additions & 1 deletion src/components/Timeline.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.timeline {
width: 30%;
width: 80%;
padding: 20px;
word-wrap: break-word;
margin: auto;
text-align: left;
}
22 changes: 19 additions & 3 deletions src/components/Timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,25 @@ import React from 'react';
import './Timeline.css';
import TimelineEvent from './TimelineEvent';

const Timeline = () => {

return;
const Timeline = (props) => {
const eventComponents = props.events.map((event) => {

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

});

return (
<section className="timeline">
{eventComponents}
</section>
);
}

export default Timeline;
2 changes: 1 addition & 1 deletion src/components/TimelineEvent.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.timeline-event {
display: grid;
grid-template: 2rem auto 2rem / 1fr 1fr;
grid-template: 3rem auto 2rem / 8fr 8fr;
padding: 0.5rem;
border-bottom: 1px solid #E6ECF0;
background-color: #FFF;
Expand Down
11 changes: 9 additions & 2 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 = () => {
const TimelineEvent = (event) => {

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

}

export default TimelineEvent;