aboutsummaryrefslogtreecommitdiff
path: root/src/pages/FeedPage
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-07-03 22:44:38 +0300
committereug-vs <eug-vs@keemail.me>2020-07-03 22:44:38 +0300
commit6a216b903899d1481f93ebff40e246f60c4c3e89 (patch)
tree9cae6a4aa2318e36015ef98116096ccd2f03a6e1 /src/pages/FeedPage
parentf74dedfce4ade65cfe023c973a6c137a56c88ab5 (diff)
downloadwhich-ui-6a216b903899d1481f93ebff40e246f60c4c3e89.tar.gz
feat: adapt all pages to mobile view
Diffstat (limited to 'src/pages/FeedPage')
-rw-r--r--src/pages/FeedPage/FeedPage.tsx15
-rw-r--r--src/pages/FeedPage/PollSubmission.tsx9
-rw-r--r--src/pages/FeedPage/PollSubmissionImage.tsx5
3 files changed, 13 insertions, 16 deletions
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>
</>
);