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- Kate #32

Open
wants to merge 4 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
6 changes: 3 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ Congratulations! You're submitting your assignment. Please reflect on the assign

Prompt | Response
--- | ---
What is a Component in React? |
What are props in React? |
How did you use props in this project? |
What is a Component in React? | Reusable and independent bits of code. Similar to Javascript functions but returns HTML via a render function. |
What are props in React? | Properties used for passing data from one component to another. |
How did you use props in this project? | When moving the array of events (from timeline.json) up to the App.js level, giving it a const name of events, then passing this as a props into the const TimeLine as a parameter. |
8 changes: 7 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import logo from './logo.svg';
import './App.css';
import timelineData from './data/timeline.json';
import Timeline from './components/Timeline';
import * as timeline from './data/timeline.json';

//array of events
const events = timeline.events


function App() {
console.log(timelineData);
Expand All @@ -11,9 +16,10 @@ function App() {
return (
<div className="App">
<header className="App-header">
<h1 className="App-title">Application title</h1>
<h1 className="App-title">ADA Lovelace's Social Media Feed</h1>
</header>
<main className="App-main">
<Timeline events={events}/>
</main>
</div>
);
Expand Down
18 changes: 15 additions & 3 deletions src/components/Timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,21 @@ import React from 'react';
import './Timeline.css';
import TimelineEvent from './TimelineEvent';

const Timeline = () => {
const Timeline = (props) => {

return;
}
const eventComponents = props.events.map((event, i) => {
return (
<li key={i}>
<TimelineEvent person={ event.person } status={ event.status } timeStamp={ event.timeStamp } />
</li>
);
});

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

export default Timeline;
13 changes: 10 additions & 3 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 = () => {

return;
const TimelineEvent = (props) => {

return (
<div className="timeline-event">
<div className="event-person">{props.person}</div>
<div className="event-status">{props.status}</div>
<Timestamp time={props.timeStamp}/>

</div>
);
}

export default TimelineEvent;