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 Sara Nilsen #22

Open
wants to merge 2 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
8 changes: 8 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@

.App-header {
background-color: #222;
padding-bottom: 0.5rem;
color: white;
position: fixed;
width: 100%;
z-index: 1;

}

.App-title {
Expand All @@ -14,4 +17,9 @@
.App-main {
padding-top: 7rem;
background-color: #E6ECF0;

}

.Ada-lovelace {
text-align: center;
}
15 changes: 8 additions & 7 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import logo from './logo.svg';
import './App.css';
import timelineData from './data/timeline.json';
import Timeline from './components/Timeline';
import React from "react";
import "./App.css";
import timelineData from "./data/timeline.json";
import TimelineEvent from "./components/TimelineEvent";
import Timeline from "./components/Timeline";

function App() {
console.log(timelineData);
Expand All @@ -11,12 +11,13 @@ function App() {
return (
<div className="App">
<header className="App-header">
<h1 className="App-title">Application title</h1>
<h1 className="Ada-lovelace">Ada Lovelace's social media</h1>
</header>
<main className="App-main">
<Timeline events={timelineData.events}/>
</main>
</div>
);
}

export default App;
export default App;
29 changes: 21 additions & 8 deletions src/components/Timeline.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
import React from 'react';
import './Timeline.css';
import TimelineEvent from './TimelineEvent';
import React from "react";
import "./Timeline.css";
import TimelineEvent from "./TimelineEvent";

const Timeline = (props) => {
return (
<div>
{props.events.map((event) => {
return (
<TimelineEvent
person={event.person}
status={event.status}
timestamp={event.timeStamp}
/>
);
})}
</div>
);
};

export default Timeline;

const Timeline = () => {

return;
}

export default Timeline;
25 changes: 25 additions & 0 deletions src/components/TimelineEvent.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,28 @@
margin-top: 0.5rem;
text-align: right;
}


.card {
display: block;
text-decoration: none;
border: 2px solid rgba(255, 255, 255, 0.4);
margin: 0 auto;
margin-bottom: 3rem;
max-width: 30rem;
padding: 3rem;
border-radius: 8px;
text-align: left;
transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
box-shadow: 0px 10px 8px rgba(0, 0, 0, 0.07);
border-color: white;
transform: translateY(-2px);
}

.card p {
word-break: break-all;
}

21 changes: 13 additions & 8 deletions src/components/TimelineEvent.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import React from 'react';
import './TimelineEvent.css';
import Timestamp from './Timestamp';
import React from "react";
import "./TimelineEvent.css";
import Timestamp from "./Timestamp";

const TimelineEvent = () => {

return;
}
const TimelineEvent = (props) => {
return (
<div className="card">
<Timestamp time={props.timestamp} />
<h3>{props.person}</h3>
<p>{props.status}</p>
</div>
);
};

export default TimelineEvent;
export default TimelineEvent;
12 changes: 7 additions & 5 deletions src/components/Timestamp.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import React from 'react';
import moment from 'moment';
import React from "react";
import moment from "moment";

const Timestamp = (props) => {
const time = moment(props.time);
const absolute = time.format('MMMM Do YYYY, h:mm:ss a');
const absolute = time.format("MMMM Do YYYY, h:mm:ss a");
const relative = time.fromNow();

return (
<span title={absolute}>{relative}</span>
<span title={absolute}>
{relative}
</span>
);
};

export default Timestamp;
export default Timestamp;