-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
As suggested in minhtranite/react-notifications#29
- Loading branch information
1 parent
b50f46d
commit e6c03d6
Showing
1 changed file
with
91 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
declare module 'react-notifications' { | ||
import { EventEmitter } from 'events' | ||
import { ReactNode } from 'react' | ||
|
||
enum NotificationType { | ||
INFO = 'info', | ||
SUCCESS = 'success', | ||
WARNING = 'warning', | ||
ERROR = 'error', | ||
} | ||
|
||
enum EventType { | ||
CHANGE = 'change', | ||
INFO = 'info', | ||
SUCCESS = 'success', | ||
WARNING = 'warning', | ||
ERROR = 'error', | ||
} | ||
|
||
interface NotificationProps { | ||
type: NotificationType | ||
title?: ReactNode | ||
message: ReactNode | ||
timeOut?: number | ||
onClick: () => any | ||
onRequestHide: () => any | ||
} | ||
|
||
interface NotificationsProps { | ||
notifications: Notification[] | ||
onRequestHide?: (notification: Notification) => any | ||
enterTimeout?: number | ||
leaveTimeout?: number | ||
} | ||
|
||
interface NotificationContainerProps { | ||
enterTimeout?: number | ||
leaveTimeout?: number | ||
} | ||
|
||
interface INotificationManagerCreate { | ||
type: EventType | ||
title?: NotificationProps['title'] | ||
message?: NotificationProps['message'] | ||
timeout?: number | ||
onClick?: () => any | ||
priority?: boolean | ||
} | ||
|
||
class Notification extends React.Component<NotificationProps, object> {} | ||
|
||
class Notifications extends React.Component<NotificationsProps, object> {} | ||
|
||
class NotificationContainer extends React.Component< | ||
NotificationContainerProps, | ||
object | ||
> {} | ||
|
||
class NotificationManager extends EventEmitter { | ||
static create(INotificationManagerCreate): void | ||
static info( | ||
message?: INotificationManagerCreate['message'], | ||
title?: INotificationManagerCreate['title'], | ||
timeOut?: INotificationManagerCreate['timeout'], | ||
onClick?: INotificationManagerCreate['onClick'], | ||
priority?: INotificationManagerCreate['priority'] | ||
): void | ||
static success( | ||
message?: INotificationManagerCreate['message'], | ||
title?: INotificationManagerCreate['title'], | ||
timeOut?: INotificationManagerCreate['timeout'], | ||
onClick?: INotificationManagerCreate['onClick'], | ||
priority?: INotificationManagerCreate['priority'] | ||
): void | ||
static warning( | ||
message?: INotificationManagerCreate['message'], | ||
title?: INotificationManagerCreate['title'], | ||
timeOut?: INotificationManagerCreate['timeout'], | ||
onClick?: INotificationManagerCreate['onClick'], | ||
priority?: INotificationManagerCreate['priority'] | ||
): void | ||
static error( | ||
message?: INotificationManagerCreate['message'], | ||
title?: INotificationManagerCreate['title'], | ||
timeOut?: INotificationManagerCreate['timeout'], | ||
onClick?: INotificationManagerCreate['onClick'], | ||
priority?: INotificationManagerCreate['priority'] | ||
): void | ||
static remove(notification: Notification): void | ||
} | ||
} |