MyCrypto/common/actions/notifications/actionCreators.ts
James Prado 2075a416ae Animate transaction notifications & fix styles (#305)
* Add disclaimer modal to footer

* Remove duplicate code & unnecessary styles

* Fix formatting noise

* remove un-used css style

* Fix tslint error & add media query for modals

* Nest Media Query

* Add react-transition-group

* Animate notifications with react-transition-group

* Identify issue with notifications getting overridden

* Update RTG (react-transition-group) to v2 & identify keys as animation issue

* Add unique id on successful transactions for unique keys

* update classNames, remove unused import

* Revert removing lodash

* Remove unnecessary test util

* Remove formatting noise

* Remove all formatting noise

* Update CSS & Change notification unique id

* Add unique id for each notification
2017-11-06 22:20:19 -08:00

31 lines
749 B
TypeScript

import { ReactElement } from 'react';
import * as types from './actionTypes';
import { TypeKeys } from './constants';
export type TShowNotification = typeof showNotification;
export function showNotification(
level: types.NOTIFICATION_LEVEL = 'info',
msg: ReactElement<any> | string,
duration?: number | types.INFINITY
): types.ShowNotificationAction {
return {
type: TypeKeys.SHOW_NOTIFICATION,
payload: {
level,
msg,
duration,
id: Math.random()
}
};
}
export type TCloseNotification = typeof closeNotification;
export function closeNotification(
notification: types.Notification
): types.CloseNotificationAction {
return {
type: TypeKeys.CLOSE_NOTIFICATION,
payload: notification
};
}