lbry-desktop/ui/component/channelMuteButton/view.jsx

34 lines
696 B
React
Raw Normal View History

// @flow
import React from 'react';
import Button from 'component/button';
type Props = {
uri: string,
isMuted: boolean,
channelClaim: ?ChannelClaim,
2021-06-11 22:49:18 +02:00
doChannelMute: (string, boolean) => void,
doChannelUnmute: (string, boolean) => void,
};
function ChannelBlockButton(props: Props) {
2021-06-11 22:49:18 +02:00
const { uri, doChannelMute, doChannelUnmute, isMuted } = props;
function handleClick() {
if (isMuted) {
doChannelUnmute(uri, false);
} else {
doChannelMute(uri, false);
}
}
return (
<Button
button={isMuted ? 'alt' : 'secondary'}
label={isMuted ? __('Unmute') : __('Mute')}
2021-06-11 22:49:18 +02:00
onClick={handleClick}
/>
);
}
export default ChannelBlockButton;