Skip to content

Commit

Permalink
chore: add react-notification types
Browse files Browse the repository at this point in the history
  • Loading branch information
ingeridhellen committed Apr 21, 2023
1 parent b50f46d commit e6c03d6
Showing 1 changed file with 91 additions and 0 deletions.
91 changes: 91 additions & 0 deletions packages/dm-core-plugins/src/react-notifications.d.ts
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
}
}

0 comments on commit e6c03d6

Please sign in to comment.