Skip to content

Commit bf6ad7b

Browse files
tborsamxmitchlealininPascal van Leeuwenevybauer
committed
React router and Use context demo
Co-authored-by: Mitch Lum <mklum88@gmail.com> Co-authored-by: lealinin <lea.linin@gmail.com> Co-authored-by: Pascal van Leeuwen <pascalvanleeuwen604@gmail.com> Co-authored-by: Evelyn Bauer <evybauer@gmail.com> Co-authored-by: Frederick Lee <frederick.gfl@gmail.com> Co-authored-by: 7FigureSwagger <swistek.labs@gmail.com> Co-authored-by: AliceMathews <alice_mathews@hotmail.co.uk> Co-authored-by: Tausif Ezaj Khan <engr.tausifkhan@gmail.com> Co-authored-by: diwedi1112@gmail.com <diwedi1112@gmail.com> Co-authored-by: oceanway1 <oceanway1@yahoo.ca> Co-authored-by: Jay <hollowic@hotmail.com> Co-authored-by: Panos Hatzinikolaou <pjhatzis@gmail.com> Co-authored-by: kogantimounika <kogantimounica@gmail.com> Co-authored-by: ApamAa <apama.jamshidi@gmail.com> Co-authored-by: Porson Lee <porsonlee@gmail.com> Co-authored-by: Edison Yang <edison.cy.yang@gmail.com> Co-authored-by: Jay Seo <sjs5953@hotmail.com>
1 parent 106cfaf commit bf6ad7b

35 files changed

Lines changed: 15171 additions & 19 deletions

File tree

package-lock.json

Lines changed: 14771 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: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6+
"@material-ui/core": "^4.7.1",
7+
"antd": "^3.26.0",
68
"react": "^16.12.0",
79
"react-dom": "^16.12.0",
8-
"react-scripts": "3.2.0"
10+
"react-router-dom": "^5.1.2",
11+
"react-scripts": "3.2.0",
12+
"styled-components": "^4.4.1"
913
},
1014
"scripts": {
1115
"start": "react-scripts start",

src/App.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,17 @@
2020
.App-link {
2121
color: #09d3ac;
2222
}
23+
24+
.menu {
25+
display: flex;
26+
width: 100%;
27+
flex-wrap: wrap;
28+
}
29+
.menu a {
30+
padding: 10px;
31+
color: lightslategray;
32+
text-decoration: none;
33+
border-radius: 5px;
34+
background-color: lightblue;
35+
margin: 10px;
36+
}

src/App.js

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,51 @@
11
import React from 'react';
2-
import logo from './logo.svg';
2+
import {BrowserRouter as Router, Route, Switch, Link} from 'react-router-dom';
33
import './App.css';
4+
import AppContext from './context/AppContext';
5+
6+
//get routes
7+
import contactRoutes from './screens/contact/routes';
8+
import bobRoutes from './screens/bob_ross/routes';
9+
import tausifRoute from './screens/Tausif/routes';
10+
import HappyPath from './screens/happypath/routes';
11+
import evelynRoutes from './screens/Evelyn/routes';
12+
import HelloButtonRoutes from "./screens/fred/routes/HelloButtonRoute";
13+
import Alice from "./screens/alice/routes";
14+
// import prateek from "./screens/Prateek/routes/index";
15+
import useDogs from './screens/contact/hooks/useDogs';
16+
417

518
function App() {
19+
const dogs = useDogs(['roofus', 'spotter', 'boogey', 'ben']);
620
return (
7-
<div className="App">
8-
<header className="App-header">
9-
<img src={logo} className="App-logo" alt="logo" />
10-
<p>
11-
Edit <code>src/App.js</code> and save to reload.
12-
</p>
13-
<a
14-
className="App-link"
15-
href="https://reactjs.org"
16-
target="_blank"
17-
rel="noopener noreferrer"
18-
>
19-
Learn React
20-
</a>
21-
</header>
22-
</div>
21+
<AppContext.Provider value={{dogs: dogs, data: 'sdfsf'}}>
22+
<Router>
23+
<h1>This is our app</h1>
24+
<div className="menu">
25+
<Link to="/contact">Contact</Link>
26+
<Link to="/tausif">Tausif</Link>
27+
<Link to="/fred">Fred</Link>
28+
<Link to="/bob">Bob the Ross</Link>
29+
<Link to="/alice">Alice</Link>
30+
<Link to="/happypath">Happy Path</Link>
31+
{/* <Link to="/prateek">Prateek</Link> */}
32+
<Link to="/mounika">Mounika</Link>
33+
<Link to="/evelyn">Evelyn</Link>
34+
</div>
35+
<Switch>
36+
{[
37+
...contactRoutes,
38+
...bobRoutes,
39+
...tausifRoute,
40+
...evelynRoutes,
41+
...HelloButtonRoutes,
42+
...HappyPath,
43+
...Alice
44+
]}
45+
</Switch>
46+
</Router>
47+
</AppContext.Provider>
2348
);
2449
}
2550

26-
export default App;
51+
export default App;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from 'react';
2+
import {Route} from 'react-router-dom';
3+
4+
const subject_01 = (props) => {
5+
return (
6+
<div>
7+
<h1>Project Superman Experinentation</h1>
8+
<p>Official Name: Project Superman</p>
9+
<p>Status: Defunct</p>
10+
<p>Identity: Secret</p>
11+
<p>Base of operations: Metropolis</p>
12+
<p>Univerise: Flashpoint Paradox</p>
13+
14+
<Route path="/home/subject_01" component={(bruce_wayne) => (<h1></h1>)} />
15+
</div>
16+
);
17+
};
18+
19+
export default subject_01;

src/bruce_wayne/routes/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from 'react';
2+
import {Route} from 'react-router-dom';
3+
import justice_league from '../components/justice_league';
4+
5+
export default [
6+
<Route key="home" path="/subject-01" component={subject-01}/>
7+
]

src/context/AppContext.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import React, {createContext} from 'react';
2+
3+
const AppContext = createContext({dogs: ['roofus', 'spotter', 'boogey', 'ben']})
4+
5+
export default AppContext;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react';
2+
import {Route} from 'react-router-dom';
3+
4+
const Evelyn = (props) => {
5+
return (
6+
<div>
7+
<h1>Hello</h1>
8+
9+
<Route path="/home/evelyn" component={() => (<h1> Evelyn </h1>)} />
10+
</div>
11+
);
12+
};
13+
14+
export default Evelyn;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from 'react';
2+
import {Route} from 'react-router-dom';
3+
import Evelyn from '../components/evelyn';
4+
5+
export default [
6+
<Route key="home" path="/evelyn" component={Evelyn}/>
7+
]

src/screens/Jays/components/Myname.jsx

Whitespace-only changes.

0 commit comments

Comments
 (0)