lbry-desktop/src/ui/component/rewardLink/view.jsx

32 lines
667 B
React
Raw Normal View History

2018-04-12 22:50:32 +02:00
// @flow
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,
button: ?boolean,
2018-04-12 22:50:32 +02:00
claimReward: Reward => void,
};
const RewardLink = (props: Props) => {
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;