From 3cd9081939d2f22221065018cb501441528257fc Mon Sep 17 00:00:00 2001 From: eug-vs Date: Fri, 3 Jul 2020 22:09:22 +0300 Subject: feat: adapt header for mobile devices --- package-lock.json | 13 +++++++ package.json | 1 + src/components/Header/Header.tsx | 78 ++++++++++++++++++++++++++++------------ 3 files changed, 70 insertions(+), 22 deletions(-) diff --git a/package-lock.json b/package-lock.json index 41430ec..080ae60 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10798,6 +10798,14 @@ } } }, + "react-device-detect": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/react-device-detect/-/react-device-detect-1.13.1.tgz", + "integrity": "sha512-XTPgAMsUVHC5lMNUGiAeO2UfAfhMfjq0CBUM67eHnc9XfO7iESh6h/cffKV8VGgrZBX+dyuqJl23bLLHoav5Ig==", + "requires": { + "ua-parser-js": "^0.7.21" + } + }, "react-dom": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.13.1.tgz", @@ -13189,6 +13197,11 @@ "integrity": "sha512-hSAifV3k+i6lEoCJ2k6R2Z/rp/H3+8sdmcn5NrS3/3kE7+RyZXm9aqvxWqjEXHAd8b0pShatpcdMTvEdvAJltQ==", "dev": true }, + "ua-parser-js": { + "version": "0.7.21", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.21.tgz", + "integrity": "sha512-+O8/qh/Qj8CgC6eYBVBykMrNtp5Gebn4dlGD/kKXVkJNDwyrAwSIqwz8CDf+tsAIWVycKcku6gIXJ0qwx/ZXaQ==" + }, "unicode-canonical-property-names-ecmascript": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", diff --git a/package.json b/package.json index 40797fe..67164a7 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "lodash": "^4.17.15", "notistack": "^0.9.17", "react": "^16.13.1", + "react-device-detect": "^1.13.1", "react-dom": "^16.13.1", "react-icons": "^3.10.0", "react-scripts": "3.4.1", diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index 294c250..c6c1608 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -11,25 +11,33 @@ import NotificationsIcon from '@material-ui/icons/Notifications'; import HomeIcon from '@material-ui/icons/Home'; import { useAuth } from '../../hooks/useAuth'; import { useNavigate } from '../../hooks/useNavigate'; +import { isMobile } from 'react-device-detect'; import SearchBar from './SearchBar'; -const useStyles = makeStyles({ - root: { +const useStyles = makeStyles(theme => ({ + mobile: { + top: 'auto', + bottom: 0 + }, + toolbar: { display: 'flex', - justifyContent: 'space-around', + justifyContent: 'space-around' + }, + browserToolbar: { width: '60%', margin: 'auto' }, logo: { fontWeight: 'bold', - cursor: 'pointer' + cursor: 'pointer', + color: 'white' }, avatar: { - width: 24, - height: 24 + width: theme.spacing(3), + height: theme.spacing(3) } -}); +})); const Header: React.FC = () => { const classes = useStyles(); @@ -53,31 +61,57 @@ const Header: React.FC = () => { navigate('notifications'); }; - return ( + const FeedButton = ( + + + + ); + + const NotificationsButton = ( + + + + ); + + const ProfileButton = ( + + { user?.avatarUrl + ? + : + } + + ); + + const BrowserVersion = ( - + Which
- - - - - - - - { - user?.avatarUrl - ? - : - } - + {FeedButton} + {NotificationsButton} + {ProfileButton}
); + + const MobileVersion = ( + + + + W + + {FeedButton} + {NotificationsButton} + {ProfileButton} + + + ); + + return isMobile ? MobileVersion : BrowserVersion; }; export default Header; -- cgit v1.2.3 From f74dedfce4ade65cfe023c973a6c137a56c88ab5 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Fri, 3 Jul 2020 22:09:54 +0300 Subject: feat: adapt HomePage for mobile devices --- src/pages/HomePage/HomePage.tsx | 4 ++-- src/pages/Page.tsx | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pages/HomePage/HomePage.tsx b/src/pages/HomePage/HomePage.tsx index 8995630..35130d8 100644 --- a/src/pages/HomePage/HomePage.tsx +++ b/src/pages/HomePage/HomePage.tsx @@ -61,7 +61,7 @@ const HomePage: React.FC = () => { return ( - + logo @@ -76,7 +76,7 @@ const HomePage: React.FC = () => { - + Which one to choose? diff --git a/src/pages/Page.tsx b/src/pages/Page.tsx index 24487f3..c2b422e 100644 --- a/src/pages/Page.tsx +++ b/src/pages/Page.tsx @@ -1,6 +1,8 @@ import React from 'react'; import { makeStyles } from '@material-ui/core/styles'; import { SnackbarProvider } from 'notistack'; +import { isMobile } from 'react-device-detect'; + import ProfilePage from './ProfilePage/ProfilePage'; import FeedPage from './FeedPage/FeedPage'; import AuthPage from './AuthPage/AuthPage'; @@ -8,9 +10,10 @@ import HomePage from './HomePage/HomePage'; import NotificationsPage from './NotificationsPage/NotificationsPage'; import { useNavigate } from '../hooks/useNavigate'; + const useStyles = makeStyles(theme => ({ root: { - margin: theme.spacing(15, 5, 5, 8) + margin: isMobile ? theme.spacing(5, 2) : theme.spacing(15, 5, 5, 8) } })); -- cgit v1.2.3 From 6a216b903899d1481f93ebff40e246f60c4c3e89 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Fri, 3 Jul 2020 22:44:38 +0300 Subject: feat: adapt all pages to mobile view --- src/components/PollCard/PollCard.tsx | 8 +------- src/pages/FeedPage/FeedPage.tsx | 15 +++------------ src/pages/FeedPage/PollSubmission.tsx | 9 ++++++--- src/pages/FeedPage/PollSubmissionImage.tsx | 5 ++++- src/pages/Page.tsx | 2 +- 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 = ({ initialPoll }) => { const dominant: Which = left.votes >= right.votes ? 'left' : 'right'; return ( - +
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([]); const { isAuthenticated } = useAuth(); - const classes = useStyles(); useEffect(() => { get('/feed').then(response => { @@ -33,10 +24,10 @@ const FeedPage: React.FC = () => { }; return ( -
+ {isAuthenticated() && } -
+ ); }; 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 = ({ addPoll }) => { return ( - + {user && } -
+
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 = ({ url, setUrl }) => { const Upload = ( <> - Upload an image + Upload an image ); 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(); const [polls, setPolls] = useState([]); const [totalVotes, setTotalVotes] = useState(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 ( -
+ { totalVotes={totalVotes} /> -
+ ); }; -- cgit v1.2.3 From f6bb137ccf414ba36610c0ceea598c95683dce60 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Fri, 3 Jul 2020 23:00:04 +0300 Subject: refactor: use mui-breakpoints --- package-lock.json | 13 ------------- package.json | 1 - src/components/Header/Header.tsx | 9 ++++++--- src/pages/Page.tsx | 8 ++++++-- src/pages/ProfilePage/ProfilePage.tsx | 2 +- 5 files changed, 13 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 080ae60..41430ec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10798,14 +10798,6 @@ } } }, - "react-device-detect": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/react-device-detect/-/react-device-detect-1.13.1.tgz", - "integrity": "sha512-XTPgAMsUVHC5lMNUGiAeO2UfAfhMfjq0CBUM67eHnc9XfO7iESh6h/cffKV8VGgrZBX+dyuqJl23bLLHoav5Ig==", - "requires": { - "ua-parser-js": "^0.7.21" - } - }, "react-dom": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.13.1.tgz", @@ -13197,11 +13189,6 @@ "integrity": "sha512-hSAifV3k+i6lEoCJ2k6R2Z/rp/H3+8sdmcn5NrS3/3kE7+RyZXm9aqvxWqjEXHAd8b0pShatpcdMTvEdvAJltQ==", "dev": true }, - "ua-parser-js": { - "version": "0.7.21", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.21.tgz", - "integrity": "sha512-+O8/qh/Qj8CgC6eYBVBykMrNtp5Gebn4dlGD/kKXVkJNDwyrAwSIqwz8CDf+tsAIWVycKcku6gIXJ0qwx/ZXaQ==" - }, "unicode-canonical-property-names-ecmascript": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", diff --git a/package.json b/package.json index 67164a7..40797fe 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,6 @@ "lodash": "^4.17.15", "notistack": "^0.9.17", "react": "^16.13.1", - "react-device-detect": "^1.13.1", "react-dom": "^16.13.1", "react-icons": "^3.10.0", "react-scripts": "3.4.1", diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index c6c1608..e7f9f47 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -3,15 +3,16 @@ import { AppBar, Toolbar, IconButton, - Typography, Avatar + Typography, + Avatar, + useMediaQuery } from '@material-ui/core'; -import { makeStyles } from '@material-ui/core/styles'; +import { makeStyles, useTheme } from '@material-ui/core/styles'; import AccountCircle from '@material-ui/icons/AccountCircle'; import NotificationsIcon from '@material-ui/icons/Notifications'; import HomeIcon from '@material-ui/icons/Home'; import { useAuth } from '../../hooks/useAuth'; import { useNavigate } from '../../hooks/useNavigate'; -import { isMobile } from 'react-device-detect'; import SearchBar from './SearchBar'; @@ -43,6 +44,8 @@ const Header: React.FC = () => { const classes = useStyles(); const { user } = useAuth(); const { navigate } = useNavigate(); + const theme = useTheme(); + const isMobile = useMediaQuery(theme.breakpoints.down('sm')); const handleHome = (): void => { navigate('home'); diff --git a/src/pages/Page.tsx b/src/pages/Page.tsx index 4c46ea8..91b7214 100644 --- a/src/pages/Page.tsx +++ b/src/pages/Page.tsx @@ -1,7 +1,6 @@ import React from 'react'; import { makeStyles } from '@material-ui/core/styles'; import { SnackbarProvider } from 'notistack'; -import { isMobile } from 'react-device-detect'; import ProfilePage from './ProfilePage/ProfilePage'; import FeedPage from './FeedPage/FeedPage'; @@ -13,7 +12,12 @@ import { useNavigate } from '../hooks/useNavigate'; const useStyles = makeStyles(theme => ({ root: { - margin: isMobile ? theme.spacing(2) : theme.spacing(15, 5, 5, 8) + [theme.breakpoints.down('sm')]: { + margin: theme.spacing(2) + }, + [theme.breakpoints.up('md')]: { + margin: theme.spacing(15, 5, 5, 8) + } } })); diff --git a/src/pages/ProfilePage/ProfilePage.tsx b/src/pages/ProfilePage/ProfilePage.tsx index 9a8f69a..b7a4a75 100644 --- a/src/pages/ProfilePage/ProfilePage.tsx +++ b/src/pages/ProfilePage/ProfilePage.tsx @@ -36,7 +36,7 @@ const ProfilePage: React.FC = () => { }, [navigate, page, user]); return ( - + Date: Fri, 3 Jul 2020 23:23:56 +0300 Subject: fix: make iconbutton round --- src/components/Header/Header.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index e7f9f47..bf831d4 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -34,7 +34,7 @@ const useStyles = makeStyles(theme => ({ cursor: 'pointer', color: 'white' }, - avatar: { + round: { width: theme.spacing(3), height: theme.spacing(3) } @@ -79,7 +79,7 @@ const Header: React.FC = () => { const ProfileButton = ( { user?.avatarUrl - ? + ? : } @@ -105,7 +105,7 @@ const Header: React.FC = () => { - W + W {FeedButton} {NotificationsButton} -- cgit v1.2.3 From f95dbb6c7f119276dd9a15dc82f48c61b745d8c1 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Fri, 3 Jul 2020 23:42:06 +0300 Subject: feat: hide grid overflow in HomePage --- src/pages/HomePage/HomePage.tsx | 128 +++++++++++++++++++++------------------- 1 file changed, 67 insertions(+), 61 deletions(-) diff --git a/src/pages/HomePage/HomePage.tsx b/src/pages/HomePage/HomePage.tsx index 35130d8..f00289a 100644 --- a/src/pages/HomePage/HomePage.tsx +++ b/src/pages/HomePage/HomePage.tsx @@ -16,6 +16,10 @@ import { useAuth } from '../../hooks/useAuth'; import { get } from '../../requests'; const useStyles = makeStyles(theme => ({ + root: { + overflow: 'hidden', + padding: theme.spacing(0, 2) + }, logo: { width: theme.spacing(20), height: theme.spacing(20) @@ -60,77 +64,79 @@ const HomePage: React.FC = () => { const MUILink = Material-UI; return ( - - - - - logo - - - - - - - User score: {rating.toFixed(1)} - +
+ + + + + logo + + + + + + + User score: {rating.toFixed(1)} + + - - - - - Which one to choose? - - -

- Have you ever found yourself stuck between two options, not being able to choose any? - This is exactly the problem we are going to solve! -

-

Share your minor everyday uncertainties with the whole world and see what others think!

- - {!isAuthenticated() && ( + + + + Which one to choose? + + +

+ Have you ever found yourself stuck between two options, not being able to choose any? + This is exactly the problem we are going to solve! +

+

Share your minor everyday uncertainties with the whole world and see what others think!

+ + {!isAuthenticated() && ( + + )} +
+
+ + About the project + + +

+ The project is written in {TypescriptLink} and features {ReactLink}, {FeathersLink}, and {MUILink}. + It is currently open-source and you can visit our {GithubLink} (make sure to star our repositories)! +

+

+ We encourage any developer to check it out. Feel free to open issues and create Pull Requests! +

+

+ All the development process is being tracked on the KanBan board (thanks GitHub). + You can always check it to see what is the current state of the project. +

- )} -
-
- - About the project - - -

- The project is written in {TypescriptLink} and features {ReactLink}, {FeathersLink}, and {MUILink}. - It is currently open-source and you can visit our {GithubLink} (make sure to star our repositories)! -

-

- We encourage any developer to check it out. Feel free to open issues and create Pull Requests! -

-

- All the development process is being tracked on the KanBan board (thanks GitHub). - You can always check it to see what is the current state of the project. -

- -
+
+
- +
); }; -- cgit v1.2.3 From 6d593eebffffdeb09323198d118c8de15786ab2e Mon Sep 17 00:00:00 2001 From: eug-vs Date: Fri, 3 Jul 2020 23:42:23 +0300 Subject: feat: setup correct padding for Page --- src/pages/Page.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/Page.tsx b/src/pages/Page.tsx index 91b7214..c0ba3d2 100644 --- a/src/pages/Page.tsx +++ b/src/pages/Page.tsx @@ -13,10 +13,10 @@ import { useNavigate } from '../hooks/useNavigate'; const useStyles = makeStyles(theme => ({ root: { [theme.breakpoints.down('sm')]: { - margin: theme.spacing(2) + margin: theme.spacing(2, 0, 12, 0) }, [theme.breakpoints.up('md')]: { - margin: theme.spacing(15, 5, 5, 8) + margin: theme.spacing(15, 5, 8, 5) } } })); -- cgit v1.2.3 From 86b09f910a44502a7d7b1e14b50b2f02158dfb39 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Fri, 3 Jul 2020 23:42:32 +0300 Subject: feat: lower the height of polls --- src/components/Feed/Feed.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Feed/Feed.tsx b/src/components/Feed/Feed.tsx index 5814711..afa914d 100644 --- a/src/components/Feed/Feed.tsx +++ b/src/components/Feed/Feed.tsx @@ -42,7 +42,7 @@ const Feed: React.FC = ({ polls }) => { isScrolling={isScrolling} onScroll={onChildScroll} rowCount={polls.length} - rowHeight={600} + rowHeight={550} rowRenderer={RenderItem} scrollTop={scrollTop} width={width} -- cgit v1.2.3 From 77b583d42341d00fc1fd458f552afa2cd847d955 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Fri, 3 Jul 2020 23:45:39 +0300 Subject: feat: display notifications on top if mobile --- src/pages/Page.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pages/Page.tsx b/src/pages/Page.tsx index c0ba3d2..56d7372 100644 --- a/src/pages/Page.tsx +++ b/src/pages/Page.tsx @@ -1,5 +1,6 @@ import React from 'react'; -import { makeStyles } from '@material-ui/core/styles'; +import { makeStyles, useTheme } from '@material-ui/core/styles'; +import { useMediaQuery } from '@material-ui/core'; import { SnackbarProvider } from 'notistack'; import ProfilePage from './ProfilePage/ProfilePage'; @@ -24,12 +25,14 @@ const useStyles = makeStyles(theme => ({ const Page: React.FC = () => { const { page } = useNavigate(); const classes = useStyles(); + const theme = useTheme(); + const isMobile = useMediaQuery(theme.breakpoints.down('sm')); return ( -- cgit v1.2.3 From 2a83b58e40d60dc058f385440a3125c60fb90026 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sat, 4 Jul 2020 00:05:33 +0300 Subject: refactor: improve scrollTopArrow --- src/components/ScrollTopArrow/ScrollTopArrow.tsx | 40 ++++++++++++++---------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/src/components/ScrollTopArrow/ScrollTopArrow.tsx b/src/components/ScrollTopArrow/ScrollTopArrow.tsx index 6b9d5c9..dfa573f 100644 --- a/src/components/ScrollTopArrow/ScrollTopArrow.tsx +++ b/src/components/ScrollTopArrow/ScrollTopArrow.tsx @@ -1,26 +1,33 @@ import React, { useState } from 'react'; -import { FaArrowCircleUp } from 'react-icons/fa'; -import { makeStyles } from '@material-ui/core'; -import teal from '@material-ui/core/colors/teal'; +import { makeStyles, useTheme } from '@material-ui/core/styles'; +import { useMediaQuery } from '@material-ui/core'; +import ArrowUpwardIcon from '@material-ui/icons/ArrowUpward'; -const useStyles = makeStyles(() => ({ - scrollTop: { +const useStyles = makeStyles(theme => ({ + root: { position: 'fixed', - width: 50, - bottom: 50, - left: 50, + bottom: theme.spacing(10), + left: theme.spacing(10), zIndex: 1000, cursor: 'pointer', - opacity: 0.5, + opacity: 0.4, '&:hover': { - opacity: '1' - } + opacity: 1 + }, + background: theme.palette.primary.main, + borderRadius: '50%' + }, + icon: { + fontSize: 80, + color: 'white' } })); -const ScrollTopArrow:React.FC = () => { +const ScrollTopArrow: React.FC = () => { const [showScroll, setShowScroll] = useState(false); + const theme = useTheme(); const classes = useStyles(); + const isMobile = useMediaQuery(theme.breakpoints.down("sm")); const checkScrollTop = () => { if (!showScroll && window.pageYOffset > 400) { @@ -37,11 +44,10 @@ const ScrollTopArrow:React.FC = () => { window.addEventListener('scroll', checkScrollTop); return ( - +
+ {showScroll && !isMobile && + } +
); }; -- cgit v1.2.3 From b52743cc950e9633a2da41f72d3462286c629967 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sat, 4 Jul 2020 00:08:57 +0300 Subject: style: remove eslint errors --- src/components/Header/Header.tsx | 3 ++- src/components/PollCard/PollCard.tsx | 2 +- src/components/ScrollTopArrow/ScrollTopArrow.tsx | 9 ++++++--- src/pages/FeedPage/PollSubmission.tsx | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index bf831d4..41aeec7 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -78,7 +78,8 @@ const Header: React.FC = () => { const ProfileButton = ( - { user?.avatarUrl + { + user?.avatarUrl ? : } diff --git a/src/components/PollCard/PollCard.tsx b/src/components/PollCard/PollCard.tsx index ca85d11..98ae001 100644 --- a/src/components/PollCard/PollCard.tsx +++ b/src/components/PollCard/PollCard.tsx @@ -27,7 +27,7 @@ const DATE_FORMAT = { const useStyles = makeStyles(theme => ({ images: { - height: theme.spacing(50), + height: theme.spacing(50) }, imagesBlock: { display: 'flex' diff --git a/src/components/ScrollTopArrow/ScrollTopArrow.tsx b/src/components/ScrollTopArrow/ScrollTopArrow.tsx index dfa573f..08b8591 100644 --- a/src/components/ScrollTopArrow/ScrollTopArrow.tsx +++ b/src/components/ScrollTopArrow/ScrollTopArrow.tsx @@ -27,7 +27,7 @@ const ScrollTopArrow: React.FC = () => { const [showScroll, setShowScroll] = useState(false); const theme = useTheme(); const classes = useStyles(); - const isMobile = useMediaQuery(theme.breakpoints.down("sm")); + const isMobile = useMediaQuery(theme.breakpoints.down('sm')); const checkScrollTop = () => { if (!showScroll && window.pageYOffset > 400) { @@ -45,8 +45,11 @@ const ScrollTopArrow: React.FC = () => { return (
- {showScroll && !isMobile && - } + { + showScroll + && !isMobile + && + }
); }; diff --git a/src/pages/FeedPage/PollSubmission.tsx b/src/pages/FeedPage/PollSubmission.tsx index 5c8efbb..347eecc 100644 --- a/src/pages/FeedPage/PollSubmission.tsx +++ b/src/pages/FeedPage/PollSubmission.tsx @@ -25,7 +25,7 @@ const useStyles = makeStyles(theme => ({ }, images: { height: theme.spacing(50), - display: 'flex', + display: 'flex' } })); -- cgit v1.2.3 From 7b698a68cb3d332aecfebf7a85b2ac56f9448bea Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sat, 4 Jul 2020 00:10:12 +0300 Subject: style: improve notifications blankpage --- src/pages/NotificationsPage/NotificationsPage.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/NotificationsPage/NotificationsPage.tsx b/src/pages/NotificationsPage/NotificationsPage.tsx index d162eff..3c39ba3 100644 --- a/src/pages/NotificationsPage/NotificationsPage.tsx +++ b/src/pages/NotificationsPage/NotificationsPage.tsx @@ -2,11 +2,12 @@ import React from 'react'; import { makeStyles } from '@material-ui/core/styles'; import { Typography } from '@material-ui/core'; -const useStyles = makeStyles({ +const useStyles = makeStyles(theme => ({ root: { + marginTop: theme.spacing(40), textAlign: 'center' } -}); +})); const NotificationsPage: React.FC = () => { const classes = useStyles(); -- cgit v1.2.3