Added loading state for acquire button

pull/307/head
Vladimir Volek 5 years ago
parent e750fc2da6
commit cbbcf1f4d1

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

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

Loading…
Cancel
Save