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

Ampers: Nora Peters #22

Open
wants to merge 8 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
4,612 changes: 2,306 additions & 2,306 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
import React, { Component } from 'react';
import './App.css';
import timelineData from './data/timeline.json';

import Timeline from './components/Timeline';
import Counter from './components/Counter';


class App extends Component {
render() {
console.log(timelineData);
const name = timelineData.person

// Customize the code below
return (
<div className="App">
<header className="App-header">
<h1 className="App-title">Application title</h1>
<h1 className="App-title">{name}</h1>
</header>
<main className="App-main">
<section>
<Timeline timeline={timelineData} />
</section>
</main>
<footer>
<small><Counter/></small>
</footer>
</div>
);
}
Expand Down
19 changes: 19 additions & 0 deletions src/components/Counter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React, { Component } from 'react';

class Counter extends Component {
state = {
seconds: 0
}

componentDidMount() {
setInterval(() => {
this.setState({ seconds: this.state.seconds + 1 })
}, 1000)
}

render() {
return <h1>It has been {this.state.seconds} seconds since you arrived here.</h1>;
}
}

export default Counter;
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;
}
21 changes: 19 additions & 2 deletions src/components/Timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,26 @@ import './Timeline.css';
import TimelineEvent from './TimelineEvent';

class Timeline extends React.Component {

render() {
// Fill in your code here
return;
console.log(this.props);
const timeline = this.props.timeline
// console.log({timeline});

const timelineEvents = timeline.events.map((event) => {
return (
<TimelineEvent
key={event.timeStamp}
person={event.person}
status={event.status}
timestamp={event.timeStamp}
/>
);
});

return (
<div className="timeline">{timelineEvents}</div>
);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/components/TimelineEvent.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

.event-status {
grid-area: 2 / 1 / span 1 / -1;
word-wrap: break-word;
}

.event-time {
Expand Down
21 changes: 18 additions & 3 deletions src/components/TimelineEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,25 @@ import React, { Component } from 'react';
import './TimelineEvent.css';
import Timestamp from './Timestamp';

class TimelineEvent extends React.Component {
class TimelineEvent extends Component {
render() {
// Fill in your code here
return;
console.log(this.props);
const { person, status, timestamp } = this.props
// console.log({person})

return (
<article className="timeline-event">
<div className="event-person">
{person}
</div>
<div className="event-time">
<Timestamp time={timestamp} />
</div>
<p className="event-status">
{status}
</p>
</article>
);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/components/Timestamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import moment from 'moment';

class Timestamp extends React.Component {
render() {
console.log(this.props);
const time = moment(this.props.time);
const absolute = time.format('MMMM Do YYYY, h:mm:ss a');
const relative = time.fromNow();
Expand Down