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 - Kasey #21

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
5 changes: 4 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ class App extends Component {
return (
<div className="App">
<header className="App-header">
<h1 className="App-title">Application title</h1>
<h1 className="App-title">{timelineData.person}</h1>
</header>
<main className="App-main">
{/* <Timeline events={timelineData["events"] person={timelineData.person}} />
sooo thats not how it works, just rememnber that events just equals something, ignore it, and we can pass in multipe props but theyre still a prop? I dunno but correctness would be... */}
<Timeline events={timelineData["events"]} />
</main>
</div>
);
Expand Down
24 changes: 24 additions & 0 deletions src/components/Timeline.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
.timeline {
list-style-type: none;
width: 30%;
margin: auto;
/* text-align: left; */
/* background-color: blueviolet; */
background-color: #f8f8f8;
border: 1px solid #c8c8c8;
border-radius: 5px;
/* width: 110px; */
text-align: center;
padding: 20px;
/* position: absolute; */

overflow-wrap: break-word;
}

.name {
text-align: left;
font-weight: bold;

/* float: left; */
}

.time {
margin: auto;
float: right;
text-align: right;
}
31 changes: 27 additions & 4 deletions src/components/Timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,32 @@ import React from 'react';
import './Timeline.css';
import TimelineEvent from './TimelineEvent';

const Timeline = () => {
// Fill in your code here
return;
}
const Timeline = (props) => {
// although why do we have to do props.events? cause itsnt
// <Timeline events={timelineData.events} /> already sending it events?
// side question, how would you debug that?

const timelineComponents = props.events.map( (timeline, i) => {

Choose a reason for hiding this comment

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

This .map is running over the events prop that it got from App.js

return (
<li className="timeline" key={i}>
<TimelineEvent

Choose a reason for hiding this comment

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

This is where you're passing the props to TimelineEvent.

person={ timeline.person }
status={ timeline.status }
time={ timeline.timeStamp } />
</li>
);
});

return (
<section >
<ul>
{ timelineComponents }
</ul>
</section>
);
};




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

const TimelineEvent = () => {
const TimelineEvent = (props) => {
// Fill in your code here
return;
return (
<section>

{/* <h3>{ props.timestamp } </h3> */}

<h4 className="time"> <Timestamp time= { props.time }/></h4>
<h3 className="name">{ props.person }</h3>
{/* so, note to self, it has to match the name time on Timestamp */}

Choose a reason for hiding this comment

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

This is the part where TimelineEvent is catching the props that Timeline passed in.

<h3>
{ props.status}
</h3>
</section>
);
}

export default TimelineEvent;