aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pages/AuthPage/AuthPage.tsx50
-rw-r--r--src/pages/LoginPage/LoginPage.tsx (renamed from src/pages/AuthPage/SignInForm.tsx)6
-rw-r--r--src/pages/Page.tsx7
-rw-r--r--src/pages/RegistrationPage/RegistrationPage.tsx (renamed from src/pages/AuthPage/SignUpForm.tsx)6
4 files changed, 12 insertions, 57 deletions
diff --git a/src/pages/AuthPage/AuthPage.tsx b/src/pages/AuthPage/AuthPage.tsx
deleted file mode 100644
index ad93463..0000000
--- a/src/pages/AuthPage/AuthPage.tsx
+++ /dev/null
@@ -1,50 +0,0 @@
-import React, { useState } from 'react';
-import { makeStyles } from '@material-ui/core/styles';
-import SignInForm from './SignInForm';
-import SignUpForm from './SignUpForm';
-
-const useStyles = makeStyles({
- formTransfer: {
- display: 'flex',
- justifyContent: 'center'
- },
- transferButton: {
- marginLeft: 10,
- color: 'green',
- cursor: 'pointer'
- }
-});
-
-const AuthPage: React.FC = () => {
- const [auth, setAuth] = useState<'signIn' | 'signUp'>('signIn');
- const classes = useStyles();
-
- const handleRedirect = () => {
- setAuth(auth === 'signIn' ? 'signUp' : 'signIn');
- };
-
- const footerInfo = {
- signIn: ['Don\'t have an account?', 'Sign up'],
- signUp: ['Already have an account?', 'Sign in']
- };
-
- return (
- <>
- {auth === 'signIn' && <SignInForm />}
- {auth === 'signUp' && <SignUpForm />}
- <div className={classes.formTransfer}>
- <div>{footerInfo[auth][0]}</div>
- <span
- onClick={handleRedirect}
- className={classes.transferButton}
- role="presentation"
- >
- {footerInfo[auth][1]}
- </span>
- </div>
- </>
- );
-};
-
-export default AuthPage;
-
diff --git a/src/pages/AuthPage/SignInForm.tsx b/src/pages/LoginPage/LoginPage.tsx
index e68483b..ef31491 100644
--- a/src/pages/AuthPage/SignInForm.tsx
+++ b/src/pages/LoginPage/LoginPage.tsx
@@ -26,7 +26,7 @@ const useStyles = makeStyles(theme => ({
}
}));
-const SignInForm: React.FC = () => {
+const LoginPage: React.FC = () => {
const [error, setError] = useState<boolean>(false);
const [remember, setRemember] = useState<boolean>(true);
const classes = useStyles();
@@ -50,6 +50,8 @@ const SignInForm: React.FC = () => {
}
};
+ // TODO: Add registration redirect
+
return (
<>
<div className={classes.formHeader}>Sign In</div>
@@ -76,5 +78,5 @@ const SignInForm: React.FC = () => {
);
};
-export default SignInForm;
+export default LoginPage;
diff --git a/src/pages/Page.tsx b/src/pages/Page.tsx
index 29b9564..47f5f50 100644
--- a/src/pages/Page.tsx
+++ b/src/pages/Page.tsx
@@ -6,7 +6,8 @@ import { BrowserRouter, Switch } 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 Route from './Route';
@@ -42,8 +43,8 @@ const Page: React.FC = () => {
<div className={classes.root}>
<Switch>
<Route exact path={urls.home} component={HomePage} />
- <Route exact path={urls.login} component={AuthPage} />
- <Route exact path={urls.registration} component={AuthPage} />
+ <Route exact path={urls.login} component={LoginPage} />
+ <Route exact path={urls.registration} component={RegistrationPage} />
<Route exact path={urls.feed} component={FeedPage} />
<Route exact path={urls.notifications} component={NotificationsPage} />
<Route path={urls.profile} component={ProfilePage} />
diff --git a/src/pages/AuthPage/SignUpForm.tsx b/src/pages/RegistrationPage/RegistrationPage.tsx
index 1dacd45..e283a0e 100644
--- a/src/pages/AuthPage/SignUpForm.tsx
+++ b/src/pages/RegistrationPage/RegistrationPage.tsx
@@ -24,7 +24,7 @@ const useStyles = makeStyles(theme => ({
}
}));
-const SignUpForm: React.FC = () => {
+const RegistrationPage: React.FC = () => {
const [error, setError] = useState<boolean>(false);
const classes = useStyles();
const usernameRef = useRef<HTMLInputElement>();
@@ -44,6 +44,8 @@ const SignUpForm: React.FC = () => {
} else setError(true);
};
+ // TODO: add login redirect
+
return (
<>
<div className={classes.formHeader}>Sign Up</div>
@@ -70,4 +72,4 @@ const SignUpForm: React.FC = () => {
);
};
-export default SignUpForm;
+export default RegistrationPage;