feat(notification): add custom notification component support (#5605)
* feat: add custom notification component support * update the documentation of UINotificationService to support custom component integration --------- Co-authored-by: trenser-belbin <belbin.kunjumon@prenuvo.com>
This commit is contained in:
1 parent
fd86a9e3e8
commit
c4e5a4616d
3 files changed
+51
-9
No files matched your search
@@ -4,6 +4,7 @@ const serviceImplementation = {
|
||||
console.debug('show() NOT IMPLEMENTED');
|
||||
return null;
|
||||
},
|
||||
_customComponent: null,
|
||||
};
|
||||
|
||||
type ToastType = 'success' | 'error' | 'info' | 'warning' | 'loading';
|
||||
@@ -17,21 +18,38 @@ class UINotificationService {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* This provides flexibility in customizing the Notification default component
|
||||
*
|
||||
* @returns {React.Component}
|
||||
*/
|
||||
getCustomComponent() {
|
||||
return serviceImplementation._customComponent;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param {*} {
|
||||
* hide: hideImplementation,
|
||||
* show: showImplementation,
|
||||
* component: componentImplementation
|
||||
* }
|
||||
*/
|
||||
public setServiceImplementation({ hide: hideImplementation, show: showImplementation }): void {
|
||||
public setServiceImplementation({
|
||||
hide: hideImplementation,
|
||||
show: showImplementation,
|
||||
customComponent: customComponentImplementation,
|
||||
}): void {
|
||||
if (hideImplementation) {
|
||||
serviceImplementation._hide = hideImplementation;
|
||||
}
|
||||
if (showImplementation) {
|
||||
serviceImplementation._show = showImplementation;
|
||||
}
|
||||
if (customComponentImplementation) {
|
||||
serviceImplementation._customComponent = customComponentImplementation;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user