mirror of
https://github.com/trezor/trezor-wallet
synced 2024-12-29 02:18:06 +00:00
Add prop types & flow
This commit is contained in:
parent
c07bcec68c
commit
b0f1913a1d
@ -1,4 +1,5 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import Icon from 'components/Icon';
|
import Icon from 'components/Icon';
|
||||||
import ICONS from 'config/icons';
|
import ICONS from 'config/icons';
|
||||||
@ -99,4 +100,14 @@ class Group extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Group.propTypes = {
|
||||||
|
type: PropTypes.string,
|
||||||
|
groupNotifications: PropTypes.arrayOf({
|
||||||
|
key: PropTypes.string,
|
||||||
|
type: PropTypes.string,
|
||||||
|
title: PropTypes.string,
|
||||||
|
message: PropTypes.string,
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
|
||||||
export default Group;
|
export default Group;
|
@ -1,3 +1,5 @@
|
|||||||
|
/* @flow */
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { bindActionCreators } from 'redux';
|
import { bindActionCreators } from 'redux';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
@ -10,8 +12,25 @@ 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 { Action, State } from 'flowtype';
|
||||||
import NotificationButton from './components/NotificationButton';
|
import NotificationButton from './components/NotificationButton';
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
key?: number,
|
||||||
|
notifications: $ElementType<State, 'notifications'>,
|
||||||
|
close: (notif?: any) => Action,
|
||||||
|
};
|
||||||
|
|
||||||
|
type NProps = {
|
||||||
|
type: string,
|
||||||
|
cancelable?: boolean;
|
||||||
|
title: string;
|
||||||
|
message?: string;
|
||||||
|
actions?: Array<any>;
|
||||||
|
close?: typeof NotificationActions.close,
|
||||||
|
loading?: boolean
|
||||||
|
};
|
||||||
|
|
||||||
const Wrapper = styled.div`
|
const Wrapper = styled.div`
|
||||||
position: relative;
|
position: relative;
|
||||||
color: ${colors.TEXT_PRIMARY};
|
color: ${colors.TEXT_PRIMARY};
|
||||||
@ -141,7 +160,7 @@ export const Notification = (props: NProps): React$Element<string> => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const NotificationGroup = (props) => {
|
export const NotificationGroup = (props: Props) => {
|
||||||
const { notifications, close } = props;
|
const { notifications, close } = props;
|
||||||
return notifications.map(n => (
|
return notifications.map(n => (
|
||||||
<Notification
|
<Notification
|
||||||
@ -163,4 +182,4 @@ export default connect(
|
|||||||
dispatch => ({
|
dispatch => ({
|
||||||
close: bindActionCreators(NotificationActions.close, dispatch),
|
close: bindActionCreators(NotificationActions.close, dispatch),
|
||||||
}),
|
}),
|
||||||
)(NotificationGroup);
|
)(NotificationGroup);
|
||||||
|
Loading…
Reference in New Issue
Block a user