-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathApp.js
More file actions
56 lines (52 loc) · 1.96 KB
/
Copy pathApp.js
File metadata and controls
56 lines (52 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import React from 'react';
import 'bootstrap/dist/css/bootstrap.min.css';
import { BrowserRouter as Router, Route, withRouter } from 'react-router-dom';
import Home from './containers/home/Home';
import NavBar from './components/navbar/NavBar';
import BlogCard from './components/blog/blogCards/BlogCard';
import SingleArticle from './components/blog/singleArticle/SingleArticle';
import Footer from './components/footer/Footer';
import InspirePage from './containers/inspirePage/InspirePage';
import ResourcePage from './containers/resourcePage/ResourcePage';
import About from './containers/about/About';
import LoginPage from './containers/loginPage/LoginPage';
import SignupPage from './containers/signupPage/SignupPage';
import ProfilePage from './containers/profile/ProfilePage';
import ContactUsPage from './containers/contactUs/ContactUsPage';
import { I18nextProvider } from 'react-i18next';
import i18n from './i18n';
// This array will be mapped through to create the routes
// Home component is a placeholder until other components are created
const ROUTES = [
{ path: '/', name: 'home', Component: Home },
{ path: '/blog', name: 'blog', Component: BlogCard },
];
const LocationDisplay = withRouter(({ location }) => (
<div data-testid="location-display">{location.pathname}</div>
));
function App() {
return (
<I18nextProvider i18n={i18n}>
<Router className="App">
<NavBar routes={ROUTES} />
{ROUTES.map(({ path, Component }) => (
<Route key={path} exact path={path}>
<Component />
</Route>
))}
<Route exact path="/login">
<LoginPage />
</Route>
<Route exact path="/signup">
<SignupPage />
</Route>
<Route exact path="/blog/:id" render={(props) => <SingleArticle {...props} />} />
<Route exact path="/profile">
<ProfilePage />
</Route>
<Footer />
</Router>
</I18nextProvider>
);
}
export { App, LocationDisplay };