Skip to content

Commit 16686ba

Browse files
committed
Add page contents
1 parent 0f28cd6 commit 16686ba

12 files changed

+129
-77
lines changed

package-lock.json

Lines changed: 58 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"@testing-library/user-event": "^13.5.0",
99
"react": "^17.0.2",
1010
"react-dom": "^17.0.2",
11+
"react-router-dom": "^6.2.1",
1112
"react-scripts": "5.0.0",
1213
"web-vitals": "^2.1.4"
1314
},

public/logo192.png

-5.22 KB
Binary file not shown.

public/logo512.png

-9.44 KB
Binary file not shown.

public/robots.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/App.css

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,37 @@
11
.App {
2-
text-align: center;
2+
height: 100vh;
3+
width: 100vw;
4+
background: #75ff98;
5+
font-family: sans-serif;
6+
display: flex;
7+
flex-direction: column;
8+
justify-content: space-between;
39
}
410

5-
.App-logo {
6-
height: 40vmin;
7-
pointer-events: none;
11+
.cypress-logo {
12+
width: 1em;
13+
height: auto;
14+
margin-right: 0.25em;
815
}
916

10-
@media (prefers-reduced-motion: no-preference) {
11-
.App-logo {
12-
animation: App-logo-spin infinite 20s linear;
13-
}
17+
.main-header {
18+
display: flex;
19+
justify-content: space-between;
20+
padding: 1em;
21+
margin: 2em 4em;
22+
font-size: 2em;
23+
background-color: #75ff98;
1424
}
1525

16-
.App-header {
17-
background-color: #282c34;
18-
min-height: 100vh;
19-
display: flex;
20-
flex-direction: column;
21-
align-items: center;
22-
justify-content: center;
23-
font-size: calc(10px + 2vmin);
24-
color: white;
26+
.page-content {
27+
display: flex;
28+
justify-content: center;
29+
align-items: center;
30+
flex: 1 1 100%;
2531
}
2632

27-
.App-link {
28-
color: #61dafb;
29-
}
30-
31-
@keyframes App-logo-spin {
32-
from {
33-
transform: rotate(0deg);
34-
}
35-
to {
36-
transform: rotate(360deg);
37-
}
38-
}
33+
.main-tagline {
34+
display: flex;
35+
justify-content: center;
36+
font-size: 4rem;
37+
}

src/App.js

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,46 @@
1-
import logo from './logo.svg';
1+
import cypress from './static/cypress.svg';
2+
import {BrowserRouter as Router, Link, Route, Routes} from 'react-router-dom';
23
import './App.css';
34

5+
function Header() {
6+
return <header className="main-header">
7+
<Link to="/page1">Some page</Link>
8+
<Link to="/page2">Another page</Link>
9+
<Link to="/page3">A third page</Link>
10+
</header>
11+
}
12+
13+
function Home() {
14+
return <main className="App">
15+
<Header />
16+
<div className="page-content">
17+
<h1 className="main-tagline">
18+
<img src={cypress} alt="" className="cypress-logo"/> Cypress example for React
19+
</h1>
20+
</div>
21+
</main>
22+
}
23+
24+
function PageView({name}) {
25+
return <main className="App">
26+
<Header />
27+
<div className="page-content">
28+
<h1 className="main-tagline">
29+
{name}
30+
</h1>
31+
</div>
32+
</main>
33+
}
34+
435
function App() {
5-
return (
6-
<div className="App">
7-
<header className="App-header">
8-
<img src={logo} className="App-logo" alt="logo" />
9-
<p>
10-
Edit <code>src/App.js</code> and save to reload.
11-
</p>
12-
<a
13-
className="App-link"
14-
href="https://reactjs.org"
15-
target="_blank"
16-
rel="noopener noreferrer"
17-
>
18-
Learn React
19-
</a>
20-
</header>
21-
</div>
22-
);
36+
return <Router>
37+
<Routes>
38+
<Route path="/page1" exact element={<PageView name="Page one"/>} />
39+
<Route path="/page2" exact element={<PageView name="Page two"/>} />
40+
<Route path="/page3" exact element={<PageView name="Page three"/>} />
41+
<Route exact path="/" element={<Home />} />
42+
</Routes>
43+
</Router>
2344
}
2445

2546
export default App;

src/index.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,10 @@ import React from 'react';
22
import ReactDOM from 'react-dom';
33
import './index.css';
44
import App from './App';
5-
import reportWebVitals from './reportWebVitals';
65

76
ReactDOM.render(
87
<React.StrictMode>
98
<App />
109
</React.StrictMode>,
1110
document.getElementById('root')
12-
);
13-
14-
// If you want to start measuring performance in your app, pass a function
15-
// to log results (for example: reportWebVitals(console.log))
16-
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
17-
reportWebVitals();
11+
);

src/logo.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/reportWebVitals.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/setupTests.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/static/cypress.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)