diff options
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/Feed/Feed.tsx | 1 | ||||
-rw-r--r-- | src/components/Header/Header.tsx | 6 | ||||
-rw-r--r-- | src/components/Highlight/Highlight.tsx | 39 | ||||
-rw-r--r-- | src/components/UploadImage/UploadImage.tsx | 25 |
4 files changed, 16 insertions, 55 deletions
diff --git a/src/components/Feed/Feed.tsx b/src/components/Feed/Feed.tsx index 06b5087..0c4d84f 100644 --- a/src/components/Feed/Feed.tsx +++ b/src/components/Feed/Feed.tsx @@ -18,7 +18,6 @@ const useStyles = makeStyles(theme => ({ const Feed: React.FC<PropTypes> = ({ polls, navigate }) => { const classes = useStyles(); - console.log(polls); return ( <div className={classes.root}> {polls.map(poll => <PollCard initialPoll={poll} key={poll._id} navigate={navigate} />)} diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index a5e6817..2e3fc20 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -27,7 +27,7 @@ const useStyles = makeStyles({ logo: { fontWeight: 'bold' }, - avatar:{ + avatar: { width: 24, height: 24 } @@ -62,8 +62,8 @@ const Header: React.FC<PropTypes> = ({ navigate, userImage }) => { </IconButton> <IconButton onClick={handleProfile}> { - userImage!== undefined - ? <Avatar className={classes.avatar} src={userImage}/> + userImage !== undefined + ? <Avatar className={classes.avatar} src={userImage} /> : <AccountCircle /> } </IconButton> diff --git a/src/components/Highlight/Highlight.tsx b/src/components/Highlight/Highlight.tsx deleted file mode 100644 index 8e11c34..0000000 --- a/src/components/Highlight/Highlight.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import React, {useState} from 'react'; -import {makeStyles} from '@material-ui/core/styles'; - -interface PropTypes { - text: string; - value: any; -} - -const useStyles = makeStyles({ - root: { - position: 'relative' - }, - menuButton: { - width: 200, - height: 50, - textAlign: 'center', - }, - menuNumber: { - fontWeight: 800, - color: 'black' - }, - menuText: { - color: 'darkgray' - }, -}); - - -const Highlight: React.FC<PropTypes> = ({text, value}) => { - const classes = useStyles(); - - return ( - <div className={classes.menuButton}> - <div className={classes.menuNumber}>{value}</div> - <div className={classes.menuText}>{text}</div> - </div> - ); -}; - -export default Highlight; diff --git a/src/components/UploadImage/UploadImage.tsx b/src/components/UploadImage/UploadImage.tsx index 929151f..42ee989 100644 --- a/src/components/UploadImage/UploadImage.tsx +++ b/src/components/UploadImage/UploadImage.tsx @@ -1,4 +1,4 @@ -import React, {useRef} from 'react'; +import React, { useRef } from 'react'; import Button from '@material-ui/core/Button'; import TextField from '@material-ui/core/TextField'; import Dialog from '@material-ui/core/Dialog'; @@ -6,28 +6,29 @@ import DialogActions from '@material-ui/core/DialogActions'; import DialogContent from '@material-ui/core/DialogContent'; import DialogContentText from '@material-ui/core/DialogContentText'; import DialogTitle from '@material-ui/core/DialogTitle'; -import {patch} from "../../requests"; -import {User} from 'which-types'; +import { User } from 'which-types'; +import { patch } from '../../requests'; interface PropTypes { - displayD: boolean; - setDisplayD: (d: boolean) => void; - setUserInfo: (a: User) => void; - setUser: (a: User) => void + displayD: boolean; + setDisplayD: (d: boolean) => void; + setUserInfo: (a: User) => void; + setUser: (a: User) => void } -const UploadImage: React.FC<PropTypes> = ({displayD,setDisplayD,setUserInfo,setUser}) => { +const UploadImage: React.FC<PropTypes> = ({ + displayD, setDisplayD, setUserInfo, setUser +}) => { const urlRef = useRef<HTMLInputElement>(null); const handleClose = () => { setDisplayD(false); }; - const updateAvatar = (event: any) => { + const updateAvatar = () => { const id = localStorage.getItem('userId'); const newAvatar = urlRef.current?.value; - console.log(newAvatar); - patch(`/users/${id}`, {avatarUrl: newAvatar}).then(res => { + patch(`/users/${id}`, { avatarUrl: newAvatar }).then(res => { setUserInfo(res.data); setUser(res.data); }); @@ -36,7 +37,7 @@ const UploadImage: React.FC<PropTypes> = ({displayD,setDisplayD,setUserInfo,set return ( <div> - <Dialog open={displayD} onClose={handleClose} > + <Dialog open={displayD} onClose={handleClose}> <DialogTitle id="form-dialog-title">Upload an Image</DialogTitle> <DialogContent> <DialogContentText> |