1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-12-29 02:18:06 +00:00

Added loading state for acquire button

This commit is contained in:
Vladimir Volek 2019-01-07 15:36:47 +01:00
parent e750fc2da6
commit cbbcf1f4d1
2 changed files with 23 additions and 22 deletions

View File

@ -19,6 +19,7 @@ type Props = {
className?: string; className?: string;
message?: ?string; message?: ?string;
actions?: Array<CallbackAction>; actions?: Array<CallbackAction>;
isActionInProgress?: boolean;
close?: typeof NotificationActions.close, close?: typeof NotificationActions.close,
loading?: boolean loading?: boolean
}; };
@ -122,6 +123,7 @@ const Notification = (props: Props): React$Element<string> => {
<NotificationButton <NotificationButton
key={action.label} key={action.label}
type={props.type} type={props.type}
isLoading={props.isActionInProgress}
onClick={() => { close(); action.callback(); }} onClick={() => { close(); action.callback(); }}
>{action.label} >{action.label}
</NotificationButton> </NotificationButton>

View File

@ -21,28 +21,27 @@ const Wrapper = styled.div`
flex: 1; flex: 1;
`; `;
const Acquire = (props: Props) => { const Acquire = (props: Props) => (
const actions = props.acquiring ? [] : [ <Wrapper>
{ <Notification
label: 'Acquire device', title="Device is used in other window"
callback: () => { message="Do you want to use your device in this window?"
props.acquireDevice(); type="info"
}, cancelable={false}
}, isActionInProgress={props.acquiring}
]; actions={
[
return ( {
<Wrapper> label: 'Acquire device',
<Notification callback: () => {
title="Device is used in other window" props.acquireDevice();
message="Do you want to use your device in this window?" },
type="info" },
cancelable={false} ]
actions={actions} }
/> />
</Wrapper> </Wrapper>
); );
};
export default connect( export default connect(
(state: State) => ({ (state: State) => ({