fix: header navigation links

fix: notification center css
This commit is contained in:
Sérgio Salgado 2021-12-17 15:47:28 +00:00
parent 9553bf8fc9
commit 8ce969ae2c
5 changed files with 48 additions and 44 deletions

View file

@ -153,7 +153,6 @@ const NotificationCenter = ({
{!loading && buildNotifications()} {!loading && buildNotifications()}
</div> </div>
</div> </div>
<div className={classes.background} />
</> </>
) )
} }

View file

@ -8,22 +8,16 @@ import {
} from 'src/styling/variables' } from 'src/styling/variables'
const styles = { const styles = {
background: { container: {
position: 'absolute', '@media only screen and (max-width: 1920px)': {
width: '100vw', width: '30vw'
height: '100vh', },
left: 0, width: '40vw',
top: 0, height: '110vh',
zIndex: -1, right: 0,
backgroundColor: white, backgroundColor: white,
boxShadow: '0 0 14px 0 rgba(0, 0, 0, 0.24)' boxShadow: '0 0 14px 0 rgba(0, 0, 0, 0.24)'
}, },
container: {
left: -200,
top: -42,
backgroundColor: white,
height: '110vh'
},
header: { header: {
display: 'flex', display: 'flex',
justifyContent: 'space-between' justifyContent: 'space-between'
@ -39,7 +33,7 @@ const styles = {
}, },
notificationIcon: ({ buttonCoords, xOffset }) => ({ notificationIcon: ({ buttonCoords, xOffset }) => ({
position: 'absolute', position: 'absolute',
top: buttonCoords ? buttonCoords.y - 1 : 0, top: buttonCoords ? buttonCoords.y : 0,
left: buttonCoords ? buttonCoords.x - xOffset : 0, left: buttonCoords ? buttonCoords.x - xOffset : 0,
cursor: 'pointer', cursor: 'pointer',
background: 'transparent', background: 'transparent',
@ -54,21 +48,33 @@ const styles = {
backgroundColor: zircon backgroundColor: zircon
}, },
notificationsList: { notificationsList: {
width: 440,
height: '90vh', height: '90vh',
maxHeight: '100vh', maxHeight: '100vh',
marginTop: spacer * 3, marginTop: spacer * 3,
marginLeft: 0, marginLeft: 0,
marginRight: -50,
overflowY: 'auto', overflowY: 'auto',
overflowX: 'hidden', overflowX: 'hidden',
backgroundColor: white, backgroundColor: white,
zIndex: 10 zIndex: 10
}, },
notificationRow: { notificationRow: {
display: 'flex',
flexDirection: 'row',
justifyContent: 'flex-start',
position: 'relative', position: 'relative',
marginBottom: spacer / 2, marginBottom: spacer / 2,
paddingTop: spacer * 1.5 paddingTop: spacer * 1.5,
'& > *': {
marginRight: 10
},
'& > *:last-child': {
marginRight: 0
}
},
notificationContent: {
display: 'flex',
flexDirection: 'column',
justifyContent: 'center'
}, },
unread: { unread: {
backgroundColor: spring3 backgroundColor: spring3
@ -79,6 +85,9 @@ const styles = {
marginLeft: spacer * 3 marginLeft: spacer * 3
} }
}, },
readIconWrapper: {
flexGrow: 1
},
unreadIcon: { unreadIcon: {
marginLeft: spacer, marginLeft: spacer,
marginTop: 5, marginTop: 5,

View file

@ -1,4 +1,3 @@
import Grid from '@material-ui/core/Grid'
import { makeStyles } from '@material-ui/core/styles' import { makeStyles } from '@material-ui/core/styles'
import classnames from 'classnames' import classnames from 'classnames'
import prettyMs from 'pretty-ms' import prettyMs from 'pretty-ms'
@ -54,36 +53,27 @@ const NotificationRow = ({
[classes.unreadIcon]: !read [classes.unreadIcon]: !read
} }
return ( return (
<Grid <div
container
className={classnames( className={classnames(
classes.notificationRow, classes.notificationRow,
!read && valid ? classes.unread : '' !read && valid ? classes.unread : ''
)}> )}>
<Grid item xs={2} className={classes.notificationRowIcon}> <div className={classes.notificationRowIcon}>{icon}</div>
{icon} <div className={classes.notificationContent}>
</Grid> <Label2 className={classes.notificationTitle}>
<Grid item container xs={7} direction="row"> {notificationTitle}
<Grid item xs={12}> </Label2>
<Label2 className={classes.notificationTitle}> <TL2 className={classes.notificationBody}>{message}</TL2>
{notificationTitle} <Label1 className={classes.notificationSubtitle}>{age}</Label1>
</Label2> </div>
</Grid> <div className={classes.readIconWrapper}>
<Grid item xs={12}>
<TL2 className={classes.notificationBody}>{message}</TL2>
</Grid>
<Grid item xs={12}>
<Label1 className={classes.notificationSubtitle}>{age}</Label1>
</Grid>
</Grid>
<Grid item xs={3} style={{ zIndex: 1 }}>
<div <div
onClick={() => toggleClear(id)} onClick={() => toggleClear(id)}
className={classnames(iconClass)} className={classnames(iconClass)}
/> />
</Grid> </div>
{!valid && <StripesSvg className={classes.stripes} />} {!valid && <StripesSvg className={classes.stripes} />}
</Grid> </div>
) )
} }

View file

@ -103,7 +103,7 @@ const Header = memo(({ tree, user }) => {
const handleClick = event => { const handleClick = event => {
const coords = notifCenterButtonRef.current.getBoundingClientRect() const coords = notifCenterButtonRef.current.getBoundingClientRect()
setNotifButtonCoords({ x: coords.x, y: coords.y }) setNotifButtonCoords({ x: coords.x, y: coords.y + 5 })
setAnchorEl(anchorEl ? null : event.currentTarget) setAnchorEl(anchorEl ? null : event.currentTarget)
document.querySelector('#root').classList.add('root-notifcenter-open') document.querySelector('#root').classList.add('root-notifcenter-open')
@ -132,7 +132,7 @@ const Header = memo(({ tree, user }) => {
return ( return (
<NavLink <NavLink
key={idx} key={idx}
to={it.route || it.children[0].route} to={!R.isNil(it.children) ? it.children[0].route : it.route}
isActive={match => { isActive={match => {
if (!match) return false if (!match) return false
setActive(it) setActive(it)
@ -173,10 +173,16 @@ const Header = memo(({ tree, user }) => {
anchorEl={anchorEl} anchorEl={anchorEl}
className={classes.popper} className={classes.popper}
disablePortal={false} disablePortal={false}
placement="bottom-end"
modifiers={{ modifiers={{
offset: {
enabled: true,
offset: '100vw'
},
preventOverflow: { preventOverflow: {
enabled: true, enabled: true,
boundariesElement: 'viewport' boundariesElement: 'viewport',
padding: 0
} }
}}> }}>
<NotificationCenter <NotificationCenter

View file

@ -171,7 +171,7 @@ const styles = {
hasUnread: { hasUnread: {
position: 'absolute', position: 'absolute',
top: 4, top: 4,
left: 182, left: 186,
width: '9px', width: '9px',
height: '9px', height: '9px',
backgroundColor: secondaryColor, backgroundColor: secondaryColor,