2018-04-12 22:50:32 +02:00
|
|
|
// @flow
|
2017-12-21 22:08:54 +01:00
|
|
|
import React from 'react';
|
2018-03-26 23:32:43 +02:00
|
|
|
import Button from 'component/button';
|
2017-05-26 10:53:32 +02:00
|
|
|
|
2018-04-12 22:50:32 +02:00
|
|
|
type Reward = {
|
|
|
|
reward_amount: number,
|
|
|
|
};
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
isPending: boolean,
|
|
|
|
label: ?string,
|
|
|
|
reward: Reward,
|
2018-04-23 07:17:54 +02:00
|
|
|
button: ?boolean,
|
2018-04-12 22:50:32 +02:00
|
|
|
claimReward: Reward => void,
|
|
|
|
};
|
|
|
|
|
|
|
|
const RewardLink = (props: Props) => {
|
2019-01-17 07:34:31 +01:00
|
|
|
const { reward, claimReward, label, isPending, button } = props;
|
2018-03-26 23:32:43 +02:00
|
|
|
return !reward ? null : (
|
2019-02-04 18:45:30 +01:00
|
|
|
<Button
|
2019-06-17 22:32:38 +02:00
|
|
|
button={button ? 'inverse' : 'link'}
|
2019-02-04 18:45:30 +01:00
|
|
|
disabled={isPending}
|
|
|
|
label={isPending ? __('Claiming...') : label || `${__('Get')} ${reward.reward_amount} LBC`}
|
|
|
|
onClick={() => {
|
|
|
|
claimReward(reward);
|
|
|
|
}}
|
|
|
|
/>
|
2017-06-08 02:56:52 +02:00
|
|
|
);
|
|
|
|
};
|
2018-04-12 22:50:32 +02:00
|
|
|
|
2017-06-08 02:56:52 +02:00
|
|
|
export default RewardLink;
|