aboutsummaryrefslogtreecommitdiff
path: root/src/pages/Page.tsx
diff options
context:
space:
mode:
authorEugene Sokolov <eug-vs@keemail.me>2020-08-08 11:28:07 +0300
committerGitHub <noreply@github.com>2020-08-08 11:28:07 +0300
commit70d533d2bcbaa689d3de6ecb532997cd68a7a842 (patch)
tree0199ab8a91f3e1bd5df0865c10695dde20a5303f /src/pages/Page.tsx
parent84eaed2f29ac370eea7c4a7ded6fb3d4661c9679 (diff)
parent104c658fc411536e09931191721411de448f964f (diff)
downloadwhich-ui-70d533d2bcbaa689d3de6ecb532997cd68a7a842.tar.gz
Merge pull request #72 from which-ecosystem/feat/routing
Add basic routing
Diffstat (limited to 'src/pages/Page.tsx')
-rw-r--r--src/pages/Page.tsx20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/pages/Page.tsx b/src/pages/Page.tsx
index 56d7372..668b171 100644
--- a/src/pages/Page.tsx
+++ b/src/pages/Page.tsx
@@ -2,13 +2,14 @@ import React from 'react';
import { makeStyles, useTheme } from '@material-ui/core/styles';
import { useMediaQuery } from '@material-ui/core';
import { SnackbarProvider } from 'notistack';
+import { Switch, Route } from 'react-router-dom';
import ProfilePage from './ProfilePage/ProfilePage';
import FeedPage from './FeedPage/FeedPage';
-import AuthPage from './AuthPage/AuthPage';
+import LoginPage from './LoginPage/LoginPage';
+import RegistrationPage from './RegistrationPage/RegistrationPage';
import HomePage from './HomePage/HomePage';
import NotificationsPage from './NotificationsPage/NotificationsPage';
-import { useNavigate } from '../hooks/useNavigate';
const useStyles = makeStyles(theme => ({
@@ -22,8 +23,8 @@ const useStyles = makeStyles(theme => ({
}
}));
+
const Page: React.FC = () => {
- const { page } = useNavigate();
const classes = useStyles();
const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
@@ -37,11 +38,14 @@ const Page: React.FC = () => {
}}
>
<div className={classes.root}>
- { page.prefix === 'home' && <HomePage />}
- { page.prefix === 'profile' && <ProfilePage />}
- { page.prefix === 'feed' && <FeedPage /> }
- { page.prefix === 'auth' && <AuthPage /> }
- { page.prefix === 'notifications' && <NotificationsPage /> }
+ <Switch>
+ <Route exact path="/" component={HomePage} />
+ <Route exact path="/login" component={LoginPage} />
+ <Route exact path="/registration" component={RegistrationPage} />
+ <Route exact path="/feed" component={FeedPage} />
+ <Route exact path="/notifications" component={NotificationsPage} />
+ <Route path="/profile/:username" component={ProfilePage} />
+ </Switch>
</div>
</SnackbarProvider>
);