Skip to content
This repository has been archived by the owner on Mar 30, 2021. It is now read-only.

Commit

Permalink
Add all functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Peyper committed Jul 2, 2019
1 parent 9fe2da7 commit de4570f
Show file tree
Hide file tree
Showing 14 changed files with 312 additions and 59 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

cypress/screenshots
cypress/videos
5 changes: 5 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"version": "0.2.0",
"configurations": [
]
}
99 changes: 99 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@reach/router": "^1.2.1",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-scripts": "3.0.1"
Expand Down
37 changes: 9 additions & 28 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,33 +1,14 @@
.App {
text-align: center;
}

.App-logo {
animation: App-logo-spin infinite 20s linear;
height: 40vmin;
pointer-events: none;
}

.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
height: 120px;
padding: 10px;
box-sizing: border-box;
background-color: white;
}

.App-link {
color: #61dafb;
}

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
.App-content {
min-height: calc(100vh - 120px);
padding: 10px;
box-sizing: border-box;
background-color: #282c34;
}
43 changes: 21 additions & 22 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
import React from 'react';
import logo from './logo.svg';
import './App.css';
import React from "react";
import { Router } from "@reach/router";
import "./App.css";
import Navigation from "./Navigation";
import Home from "./Home";
import Todos from "./Todos";
import NotFound from "./NotFound";

function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
const App = () => (
<div data-testid="app" className="App">
<div className="App-header">
<h1>Hi Coder Academy!</h1>
<Navigation />
</div>
);
}
<div className="App-content">
<Router>
<Home path="/" />
<Todos path="/todos" />
<NotFound default />
</Router>
</div>
</div>
);

export default App;
9 changes: 0 additions & 9 deletions src/App.test.js

This file was deleted.

31 changes: 31 additions & 0 deletions src/Home.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.Home {
text-align: center;
}

.Home-logo {
animation: App-logo-spin infinite 20s linear;
height: 40vmin;
pointer-events: none;
}

.Home-header {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}

.Home-link {
color: #61dafb;
}

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
24 changes: 24 additions & 0 deletions src/Home.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from "react";
import logo from "./logo.svg";
import "./Home.css";

const Home = () => (
<div data-testid="home" className="Home">
<header className="Home-header">
<img src={logo} className="Home-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="Home-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);

export default Home;
20 changes: 20 additions & 0 deletions src/Navigation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from "react";
import { Link, Match } from "@reach/router";

const NavLink = ({ text, route, active }) => (
active ? <span>{text}</span> : <Link to={route}>{text}</Link>
)

const Navigation = () => (
<nav data-testid="navigation" className="Navigation">
<Match path="/">
{({ match }) => <NavLink text="Home" route="/" active={match} />}
</Match>{" "}
|{" "}
<Match path="/todos">
{({ match }) => <NavLink text="Todos Example" route="/todos" active={match} />}
</Match>
</nav>
);

export default Navigation;
3 changes: 3 additions & 0 deletions src/NotFound.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.NotFound h1 {
color: white
}
10 changes: 10 additions & 0 deletions src/NotFound.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from "react";
import "./NotFound.css";

const NotFound = () => (
<div data-testid="not-found" className="NotFound">
<h1>Whoops!</h1>
</div>
);

export default NotFound;
Loading

0 comments on commit de4570f

Please sign in to comment.