1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-15 21:08:57 +00:00

flowtype/react fix of Notification component

This commit is contained in:
Szymon Lesisz 2018-10-10 10:55:53 +02:00
parent 9671226036
commit 4e91694a60

View File

@ -12,16 +12,17 @@ import { FONT_SIZE, FONT_WEIGHT } from 'config/variables';
import * as NotificationActions from 'actions/NotificationActions'; import * as NotificationActions from 'actions/NotificationActions';
import Loader from 'components/Loader'; import Loader from 'components/Loader';
import type { CallbackAction } from 'reducers/NotificationReducer';
import NotificationButton from './components/NotificationButton'; import NotificationButton from './components/NotificationButton';
type Props = { type Props = {
key?: React.Key,
type: string, type: string,
cancelable?: boolean; cancelable?: boolean;
title: string; title: string;
message?: string; message?: string;
actions?: Array<any>; actions?: Array<CallbackAction>;
close?: typeof NotificationActions.close, close?: typeof NotificationActions.close,
loading?: boolean loading?: boolean
}; };
@ -126,7 +127,7 @@ const Notification = (props: Props): React$Element<string> => {
const close: Function = typeof props.close === 'function' ? props.close : () => {}; // TODO: add default close action const close: Function = typeof props.close === 'function' ? props.close : () => {}; // TODO: add default close action
return ( return (
<Wrapper key={props.key} type={props.type}> <Wrapper type={props.type}>
{props.loading && <Loader size={50} /> } {props.loading && <Loader size={50} /> }
{props.cancelable && ( {props.cancelable && (
<CloseClick onClick={() => close()}> <CloseClick onClick={() => close()}>
@ -172,12 +173,11 @@ const Notification = (props: Props): React$Element<string> => {
}; };
Notification.propTypes = { Notification.propTypes = {
key: PropTypes.string,
type: PropTypes.string.isRequired, type: PropTypes.string.isRequired,
cancelable: PropTypes.bool, cancelable: PropTypes.bool,
title: PropTypes.string.isRequired, title: PropTypes.string.isRequired,
message: PropTypes.string, message: PropTypes.string,
actions: PropTypes.arrayOf(PropTypes.func), actions: PropTypes.arrayOf(PropTypes.object),
close: PropTypes.func, close: PropTypes.func,
loading: PropTypes.bool, loading: PropTypes.bool,
}; };