console: make error notifications dismissible only after clicking on the close button (close #5533) (#5780)

https://github.com/hasura/graphql-engine/pull/5780
This commit is contained in:
Varun Choudhary 2020-09-29 00:53:17 +05:30 committed by GitHub
parent ee00315ffb
commit daeb1209ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -16,7 +16,7 @@ const CONNECTION_FAILED = 'App/CONNECTION_FAILED';
* title: string null
* message: string null
* autoDismiss: integer 5, set to 0 to not auto-dismiss
* dismissible: bool true, set if user can dismiss notification
* dismissible: 'button', set if the user can dismiss the notification, false otherwise
* action: object null, action button with label string and callback function
* children: element/string, null, add custom element, over-rides action
* onAdd: function, null, called when notification is successfully created, 1st argument is the notification

View File

@ -20,7 +20,7 @@ export interface Notification {
level?: 'error' | 'warning' | 'info' | 'success';
position?: 'tr' | 'tl' | 'tc' | 'br' | 'bl' | 'bc';
autoDismiss?: number;
dismissible?: boolean;
dismissible?: 'both' | 'button' | 'click' | 'hide' | 'none' | boolean;
children?: React.ReactNode;
uid?: number | string;
action?: {
@ -43,7 +43,9 @@ export const showNotification = (
{
position: options.position || 'tr',
autoDismiss: ['error', 'warning'].includes(level) ? 0 : 5,
dismissible: ['error', 'warning'].includes(level),
dismissible: ['error', 'warning'].includes(level)
? ('button' as any) // bug in @types/react-notification-system-redux types
: ('click' as any),
...options,
},
level