-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DDW-1092] Make all notification UI/UX the same (#1748)
* [DDW-1092] INIT * [DDW-1092] Progress * [DDW-1092] Progress * [DDW-1092] Move notification logic * [DDW-1092] Register Copy Address notification * [DDW-1092] CHANGELOG entry * [DDW-1092] Progress * [DDW-1092] Translation manager * [DDW-1092] Download logs notifications * [DDW-1092] Progress * [DDW-1092] Remove unused package * [DDW-1092] Simplify logic * [DDW-1092] Handles multiple notifications * [DDW-1092] Fixed ellipsis * [DDW-1092] Fix disable button color * [DDW-1092] Fix disable button color
- Loading branch information
1 parent
36b5df8
commit 8a39853
Showing
41 changed files
with
545 additions
and
705 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
// @flow | ||
import Action from './lib/Action'; | ||
import type { | ||
NotificationConfig, | ||
NotificationId, | ||
} from '../types/notificationTypes'; | ||
|
||
// ======= NOTIFICATIONS ACTIONS ======= | ||
|
||
export default class NotificationsActions { | ||
open: Action<{ id: string, duration?: number }> = new Action(); | ||
updateDataForActiveNotification: Action<{ data: Object }> = new Action(); | ||
closeActiveNotification: Action<{ id: string }> = new Action(); | ||
resetActiveNotification: Action<any> = new Action(); | ||
registerNotification: Action<NotificationConfig> = new Action(); | ||
closeActiveNotification: Action<any> = new Action(); | ||
closeNotification: Action<{ id: NotificationId }> = new Action(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 0 additions & 122 deletions
122
source/renderer/app/components/notifications/GenericNotification.js
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
source/renderer/app/components/notifications/GenericNotification.scss
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
95 changes: 95 additions & 0 deletions
95
source/renderer/app/components/notifications/Notification.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
// @flow | ||
import React, { Component, Fragment } from 'react'; | ||
import type { Node } from 'react'; | ||
import SVGInline from 'react-svg-inline'; | ||
import classNames from 'classnames'; | ||
import styles from './Notification.scss'; | ||
import closeCross from '../../assets/images/close-cross.inline.svg'; | ||
|
||
export type NotificationMessageProps = { | ||
icon?: string, | ||
clickToClose?: boolean, | ||
hasCloseButton?: boolean, | ||
hasEllipsis?: boolean, | ||
themeOverride?: 'grey', // if left empty, the noticiation will have its normal colors | ||
labelValues?: Object, | ||
hasSpinner?: boolean, | ||
}; | ||
|
||
type Props = { | ||
...$Exact<NotificationMessageProps>, | ||
children?: Node, | ||
onClose?: Function, | ||
isVisible: boolean, | ||
index: number, | ||
}; | ||
|
||
export default class Notification extends Component<Props> { | ||
static defaultProps = { | ||
clickToClose: true, | ||
hasCloseButton: true, | ||
hasEllipsis: false, | ||
hasSpinner: false, | ||
}; | ||
|
||
render() { | ||
const { | ||
icon, | ||
children, | ||
clickToClose, | ||
hasCloseButton, | ||
hasEllipsis, | ||
onClose, | ||
index, | ||
themeOverride, | ||
isVisible, | ||
hasSpinner, | ||
} = this.props; | ||
|
||
const notificationMessageStyles = classNames([ | ||
styles.component, | ||
isVisible ? styles.isVisible : null, | ||
clickToClose ? styles.clickToClose : null, | ||
themeOverride ? styles[`theme-override-${themeOverride}`] : null, | ||
]); | ||
|
||
const messageStyles = classNames([ | ||
styles.message, | ||
hasEllipsis ? styles.hasEllipsis : null, | ||
]); | ||
|
||
const iconStyles = classNames([ | ||
styles.icon, | ||
hasSpinner ? styles.spinnerIcon : null, | ||
]); | ||
|
||
return ( | ||
<div | ||
className={notificationMessageStyles} | ||
onClick={() => clickToClose && onClose && onClose()} | ||
role="link" | ||
aria-hidden | ||
style={{ | ||
zIndex: 9999999 + index, | ||
}} | ||
> | ||
{isVisible && ( | ||
<Fragment> | ||
{icon && <SVGInline svg={icon} className={iconStyles} />} | ||
|
||
<div className={messageStyles}>{children}</div> | ||
|
||
{hasCloseButton && ( | ||
<button | ||
className={styles.closeButton} | ||
onClick={() => onClose && onClose()} | ||
> | ||
<SVGInline svg={closeCross} /> | ||
</button> | ||
)} | ||
</Fragment> | ||
)} | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
source/renderer/app/components/notifications/NotificationTransitions.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.enter { | ||
height: 0; | ||
} | ||
.enterActive { | ||
height: 62px; | ||
padding: 9px 0; | ||
} | ||
.exit { | ||
height: 62px; | ||
padding: 9px 0; | ||
} | ||
.exitActive { | ||
height: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.