diff --git a/src/NotificationsHub.js b/src/NotificationsHub.js index d4938658a..77135fef3 100644 --- a/src/NotificationsHub.js +++ b/src/NotificationsHub.js @@ -274,9 +274,10 @@ const SEVERITY_COLOR_MAP = { error: colors.red, }; -const NotificationBox = styled(FlexColumn)(props => ({ +const NotificationBox = styled(FlexRow)(props => ({ backgroundColor: props.inactive ? 'transparent' : colors.white, opacity: props.inactive ? 0.5 : 1, + alignItems: 'flex-start', borderRadius: 5, padding: 10, flexShrink: 0, @@ -302,19 +303,54 @@ const NotificationBox = styled(FlexColumn)(props => ({ }, })); -const Title = styled(FlexRow)({ +const Title = styled('div')({ + minWidth: 150, + color: colors.light80, + flexShrink: 0, + marginBottom: 6, fontWeight: 500, - marginBottom: 5, - alignItems: 'center', + lineHeight: 1, fontSize: '1.1em', }); -const Chevron = styled(Glyph)({ - position: 'absolute', - right: 10, - top: '50%', - transform: 'translateY(-50%)', - opacity: 0.5, +const NotificationContent = styled(FlexColumn)(props => ({ + marginLeft: 6, + marginRight: 10, + flexGrow: 1, + overflow: 'hidden', + maxHeight: props.isSelected ? 'none' : 56, + lineHeight: 1.4, + color: props.isSelected ? colors.light50 : colors.light30, +})); + +const Actions = styled(FlexRow)({ + alignItems: 'center', + justifyContent: 'space-between', + color: colors.light20, + marginTop: 12, + borderTop: `1px solid ${colors.light05}`, + paddingTop: 8, +}); + +const NotificationButton = styled('div')({ + border: `1px solid ${colors.light20}`, + color: colors.light50, + borderRadius: 4, + textAlign: 'center', + padding: 4, + width: 55, + marginBottom: 4, + opacity: 0, + transition: '0.15s opacity', + '[data-role="notification"]:hover &': { + opacity: 0.5, + }, + ':last-child': { + marginBottom: 0, + }, + '[data-role="notification"] &:hover': { + opacity: 1, + }, }); type ItemProps = { @@ -355,17 +391,6 @@ class NotificationItem extends Component { contextMenuItems; deepLinkButton = React.createRef(); - onClick = (e: MouseEvent) => { - if ( - this.props.notification.action && - e.target === this.deepLinkButton.current - ) { - this.openDeeplink(); - } else if (this.props.onClick) { - this.props.onClick(); - } - }; - createPaste = () => { createPaste(this.getContent()); }; @@ -400,44 +425,55 @@ class NotificationItem extends Component { return ( - - <Glyph name={this.plugin?.icon || 'bell'} size={12} /> - <span> </span> - {notification.title} - - {notification.message} + + + {notification.title} + {notification.message} + {!inactive && + isSelected && + this.plugin && + (action || onHide) && ( + + + {action && ( + + )} + {onHide && ( + + )} + + + {notification.timestamp + ? new Date(notification.timestamp).toTimeString() + : ''} + + + )} + {action && !inactive && !isSelected && ( - - )} - {!inactive && - isSelected && - this.plugin && - (action || onHide) && ( - + {action && ( - + + Open + )} {onHide && ( - + + Hide + )} - + )} );