diff options
-rw-r--r-- | package-lock.json | 13 | ||||
-rw-r--r-- | package.json | 1 | ||||
-rw-r--r-- | src/components/Header/Header.tsx | 9 | ||||
-rw-r--r-- | src/pages/Page.tsx | 8 | ||||
-rw-r--r-- | 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 ( - <Container maxWidth="sm"> + <Container maxWidth="sm" disableGutters> <ProfileInfo userInfo={userInfo} setUserInfo={setUserInfo} |