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 - Laneia #10

Open
wants to merge 9 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
7 changes: 4 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@ 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>
<h1 className="App-title">Welcome, {timelineData.person}</h1>
</header>
<main className="App-main">
<Timeline items={timelineData.events} />
</main>
</div>
);
}
}


export default App;
3 changes: 2 additions & 1 deletion src/components/Timeline.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.timeline {
width: 30%;
width: 50%;
margin: auto;
text-align: left;
font-size: 1.5rem;
}
17 changes: 14 additions & 3 deletions src/components/Timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,20 @@ 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.items.map((event, i) => {
return (
<TimelineEvent
key = {i}
person={event.person}
status={event.status}
time={event.timeStamp} />
);
});
return(
<section className="timeline">{timelineComponents}</section>
);
}


export default Timeline;
11 changes: 8 additions & 3 deletions src/components/TimelineEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
return(
<article class="timeline-event">
<p class="event-person">{props.person}</p>
<p class="event-status">{props.status}</p>
<p class="event-time"><Timestamp time={props.time} /></p>
</article>
);
}

export default TimelineEvent;
2 changes: 1 addition & 1 deletion src/components/Timestamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const Timestamp = (props) => {
const relative = time.fromNow();

return (
<span title={absolute}>{relative}</span>
<span className="event-time" title={absolute}>{relative}</span>
);
};

Expand Down
5 changes: 0 additions & 5 deletions src/data/timeline.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@
"person": "Stephanie Hurlburt",
"status": "I don’t think you can do good work if you’re not at least occasionally talking to a person you’re building for.",
"timeStamp": "2018-05-18T23:09:38Z"
},
{
"person": "Yan Zhu",
"status": "//for a good time, paste this into twitter page console: c=new AudioContext;n=setInterval(\"for(n+=7,i=k,P='\u25b2.\\\n';i-=1/k;P+=P[i%2?(i%2*j-j+n/k^j)&1:2])j=k/i;doc.innerHTML=P;with(c.createOscillator())frequency.value=200*(j+n/k^j),connect(c.destination),start(),stop(n/k)\",k=64)",
"timeStamp": "2018-05-18T23:51:01Z"
}
]
}