diff options
author | eug-vs <eug-vs@keemail.me> | 2020-08-11 22:00:10 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-08-11 22:00:10 +0300 |
commit | a9d713a73b65847af419016d2d97c4e8dab950f9 (patch) | |
tree | 653bcd474bc0aff2c4bd4c7dfba19acf89c81c81 /src/components/Header/Header.tsx | |
parent | 4bcabf751b8292fee696db5e027f38b1838b0be6 (diff) | |
download | which-ui-a9d713a73b65847af419016d2d97c4e8dab950f9.tar.gz |
refactor: cleanup header components
Diffstat (limited to 'src/components/Header/Header.tsx')
-rw-r--r-- | src/components/Header/Header.tsx | 40 |
1 files changed, 9 insertions, 31 deletions
diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index b314d79..344b839 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -1,8 +1,6 @@ import React from 'react'; import { useHistory } from 'react-router-dom'; import { - AppBar, - Toolbar, IconButton, Typography, Avatar, @@ -13,31 +11,23 @@ import { Notifications, Home, Menu, - Search, + Search } from '@material-ui/icons'; import { makeStyles, useTheme } from '@material-ui/core/styles'; import { useAuth } from '../../hooks/useAuth'; -import SearchBar from './SearchBar'; import MobileHeader from './MobileHeader'; import BottomBar from './BottomBar'; +import BrowserHeader from './BrowserHeader'; const useStyles = makeStyles(theme => ({ - toolbar: { - display: 'flex', - justifyContent: 'space-around' - }, - browserToolbar: { - width: '60%', - margin: 'auto' - }, logo: { fontWeight: 'bold', cursor: 'pointer', color: 'white' }, - round: { + avatar: { width: theme.spacing(3), height: theme.spacing(3) } @@ -86,7 +76,7 @@ const Header: React.FC = React.memo(() => { ); const search = ( - <IconButton onClick={handleNotifications}> + <IconButton> <Search /> </IconButton> ); @@ -97,36 +87,24 @@ const Header: React.FC = React.memo(() => { </Typography> ); - const profile= ( + const profile = ( <IconButton onClick={handleProfile}> { user?.avatarUrl - ? <Avatar className={classes.round} src={user?.avatarUrl} /> + ? <Avatar className={classes.avatar} src={user?.avatarUrl} /> : <AccountCircle /> } </IconButton> ); - const BrowserVersion = ( - <AppBar position="fixed"> - <Toolbar className={`${classes.toolbar} ${classes.browserToolbar}`}> - {logo} - <SearchBar /> - <div> - {feed} - {notifications} - {profile} - </div> - </Toolbar> - </AppBar> - ); - return isMobile ? ( <> <MobileHeader logo={logo} menu={menu} search={search} /> <BottomBar feed={feed} profile={profile} notifications={notifications} /> </> - ) : BrowserVersion; + ) : ( + <BrowserHeader logo={logo} profile={profile} notifications={notifications} feed={feed} /> + ); }); export default Header; |