diff options
Diffstat (limited to 'src/Pages')
-rw-r--r-- | src/Pages/ProfilePage/ProfileInfo.tsx (renamed from src/Pages/ProfilePage/ProfileInfo/ProfileInfo.tsx) | 4 | ||||
-rw-r--r-- | src/Pages/ProfilePage/ProfilePage.tsx | 30 | ||||
-rw-r--r-- | src/Pages/ProfilePage/SignInForm.tsx (renamed from src/Pages/ProfilePage/Form/SignInForm.tsx) | 4 |
3 files changed, 34 insertions, 4 deletions
diff --git a/src/Pages/ProfilePage/ProfileInfo/ProfileInfo.tsx b/src/Pages/ProfilePage/ProfileInfo.tsx index af866f8..8fce8df 100644 --- a/src/Pages/ProfilePage/ProfileInfo/ProfileInfo.tsx +++ b/src/Pages/ProfilePage/ProfileInfo.tsx @@ -2,8 +2,8 @@ import React, { useState } from 'react'; import { Avatar } from '@material-ui/core/'; import { makeStyles } from '@material-ui/core/styles'; import Button from '@material-ui/core/Button/Button'; -import { User } from '../../../types'; -import { get } from '../../../requests'; +import { User } from '../../types'; +import { get } from '../../requests'; interface PropTypes { id: string; diff --git a/src/Pages/ProfilePage/ProfilePage.tsx b/src/Pages/ProfilePage/ProfilePage.tsx new file mode 100644 index 0000000..8d082dc --- /dev/null +++ b/src/Pages/ProfilePage/ProfilePage.tsx @@ -0,0 +1,30 @@ +import React, {useState} from 'react'; +import {makeStyles} from '@material-ui/core/styles'; +import {User} from '../../types'; +import SignInForm from "./SignInForm"; +import ProfileInfo from "./ProfileInfo"; + +interface PropTypes { + id: string; + setUser: (newUser: User | undefined) => void; + user: User | undefined; +} + +const useStyles = makeStyles({ + +}); + +const ProfilePage: React.FC<PropTypes> = ({id, setUser, user}) => { + const classes = useStyles(); + + return ( + user ? ( + <> + <ProfileInfo id={user?._id || ''} setUser={setUser} /> + </> + ) + : <SignInForm setUser={setUser} /> + ) +}; + +export default ProfilePage; diff --git a/src/Pages/ProfilePage/Form/SignInForm.tsx b/src/Pages/ProfilePage/SignInForm.tsx index bfdc283..6e27535 100644 --- a/src/Pages/ProfilePage/Form/SignInForm.tsx +++ b/src/Pages/ProfilePage/SignInForm.tsx @@ -2,8 +2,8 @@ import React, { useRef } from 'react'; import { makeStyles } from '@material-ui/core/styles'; import TextField from '@material-ui/core/TextField'; import Button from '@material-ui/core/Button'; -import { User } from '../../../types'; -import { get } from '../../../requests'; +import { User } from '../../types'; +import { get } from '../../requests'; interface PropTypes { setUser: (newUser: User) => void; |