diff options
-rw-r--r-- | src/components/PollCard/PollCard.tsx | 8 | ||||
-rw-r--r-- | src/pages/FeedPage/FeedPage.tsx | 15 | ||||
-rw-r--r-- | src/pages/FeedPage/PollSubmission.tsx | 9 | ||||
-rw-r--r-- | src/pages/FeedPage/PollSubmissionImage.tsx | 5 | ||||
-rw-r--r-- | src/pages/Page.tsx | 2 | ||||
-rw-r--r-- | src/pages/ProfilePage/ProfilePage.tsx | 14 |
6 files changed, 18 insertions, 35 deletions
diff --git a/src/components/PollCard/PollCard.tsx b/src/components/PollCard/PollCard.tsx index f5a5762..ca85d11 100644 --- a/src/components/PollCard/PollCard.tsx +++ b/src/components/PollCard/PollCard.tsx @@ -26,14 +26,8 @@ const DATE_FORMAT = { }; const useStyles = makeStyles(theme => ({ - root: { - maxWidth: theme.spacing(75), - height: 488, - margin: '40px auto' - }, images: { height: theme.spacing(50), - width: 300 }, imagesBlock: { display: 'flex' @@ -103,7 +97,7 @@ const PollCard: React.FC<PropTypes> = ({ initialPoll }) => { const dominant: Which = left.votes >= right.votes ? 'left' : 'right'; return ( - <Card className={classes.root}> + <Card> <UserStrip user={author} info={date} /> <div className={classes.imagesBlock}> <CardActionArea onDoubleClick={handleLeft}> diff --git a/src/pages/FeedPage/FeedPage.tsx b/src/pages/FeedPage/FeedPage.tsx index 8149c8c..0b7d44a 100644 --- a/src/pages/FeedPage/FeedPage.tsx +++ b/src/pages/FeedPage/FeedPage.tsx @@ -1,24 +1,15 @@ import React, { useState, useEffect } from 'react'; import { Poll } from 'which-types'; -import { makeStyles } from '@material-ui/core/styles'; +import { Container } from '@material-ui/core/'; import Feed from '../../components/Feed/Feed'; import { get } from '../../requests'; import PollSubmission from './PollSubmission'; import { useAuth } from '../../hooks/useAuth'; - -const useStyles = makeStyles(theme => ({ - root: { - width: theme.spacing(75), - margin: '0 auto' - } -})); - const FeedPage: React.FC = () => { const [polls, setPolls] = useState<Poll[]>([]); const { isAuthenticated } = useAuth(); - const classes = useStyles(); useEffect(() => { get('/feed').then(response => { @@ -33,10 +24,10 @@ const FeedPage: React.FC = () => { }; return ( - <div className={classes.root}> + <Container maxWidth="sm" disableGutters> {isAuthenticated() && <PollSubmission addPoll={addPoll} />} <Feed polls={polls} /> - </div> + </Container> ); }; diff --git a/src/pages/FeedPage/PollSubmission.tsx b/src/pages/FeedPage/PollSubmission.tsx index b067914..5c8efbb 100644 --- a/src/pages/FeedPage/PollSubmission.tsx +++ b/src/pages/FeedPage/PollSubmission.tsx @@ -21,8 +21,11 @@ interface PropTypes{ const useStyles = makeStyles(theme => ({ root: { + marginBottom: theme.spacing(4) + }, + images: { height: theme.spacing(50), - display: 'flex' + display: 'flex', } })); @@ -63,11 +66,11 @@ const PollSubmission: React.FC<PropTypes> = ({ addPoll }) => { return ( <ClickAwayListener onClickAway={handleClickAway}> - <Card> + <Card className={classes.root}> <Collapse in={expanded} timeout="auto" unmountOnExit> {user && <UserStrip user={user} info="" />} <Divider /> - <div className={classes.root}> + <div className={classes.images}> <PollSubmissionImage url={contents.left.url} setUrl={setUrl('left')} /> <PollSubmissionImage url={contents.right.url} setUrl={setUrl('right')} /> </div> diff --git a/src/pages/FeedPage/PollSubmissionImage.tsx b/src/pages/FeedPage/PollSubmissionImage.tsx index a8ec437..8835989 100644 --- a/src/pages/FeedPage/PollSubmissionImage.tsx +++ b/src/pages/FeedPage/PollSubmissionImage.tsx @@ -28,6 +28,9 @@ const useStyles = makeStyles({ display: 'flex', justifyContent: 'center', alignItems: 'center' + }, + text: { + textAlign: 'center' } }); @@ -56,7 +59,7 @@ const PollSubmissionImage: React.FC<PropTypes> = ({ url, setUrl }) => { const Upload = ( <> <CloudUploadIcon fontSize="large" color="primary" /> - <Typography variant="h5"> Upload an image </Typography> + <Typography variant="h5" className={classes.text}> Upload an image </Typography> </> ); diff --git a/src/pages/Page.tsx b/src/pages/Page.tsx index c2b422e..4c46ea8 100644 --- a/src/pages/Page.tsx +++ b/src/pages/Page.tsx @@ -13,7 +13,7 @@ import { useNavigate } from '../hooks/useNavigate'; const useStyles = makeStyles(theme => ({ root: { - margin: isMobile ? theme.spacing(5, 2) : theme.spacing(15, 5, 5, 8) + margin: isMobile ? theme.spacing(2) : theme.spacing(15, 5, 5, 8) } })); diff --git a/src/pages/ProfilePage/ProfilePage.tsx b/src/pages/ProfilePage/ProfilePage.tsx index 4710ae8..9a8f69a 100644 --- a/src/pages/ProfilePage/ProfilePage.tsx +++ b/src/pages/ProfilePage/ProfilePage.tsx @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react'; import { User, Poll } from 'which-types'; -import { makeStyles } from '@material-ui/core/styles'; +import { Container } from '@material-ui/core'; import ProfileInfo from './ProfileInfo'; import Feed from '../../components/Feed/Feed'; @@ -9,20 +9,12 @@ import { useAuth } from '../../hooks/useAuth'; import { useNavigate } from '../../hooks/useNavigate'; -const useStyles = makeStyles(theme => ({ - root: { - width: theme.spacing(75), - margin: '0 auto' - } -})); - const ProfilePage: React.FC = () => { const [userInfo, setUserInfo] = useState<User>(); const [polls, setPolls] = useState<Poll[]>([]); const [totalVotes, setTotalVotes] = useState<number>(0); const { page, navigate } = useNavigate(); const { user } = useAuth(); - const classes = useStyles(); useEffect(() => { const id = page?.id || user?._id; @@ -44,7 +36,7 @@ const ProfilePage: React.FC = () => { }, [navigate, page, user]); return ( - <div className={classes.root}> + <Container maxWidth="sm"> <ProfileInfo userInfo={userInfo} setUserInfo={setUserInfo} @@ -52,7 +44,7 @@ const ProfilePage: React.FC = () => { totalVotes={totalVotes} /> <Feed polls={[...polls]} /> - </div> + </Container> ); }; |