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

34 lines
756 B
React
Raw Normal View History

2019-07-08 20:58:33 +02:00
// @flow
import React from 'react';
2019-11-22 22:13:00 +01:00
import classnames from 'classnames';
2019-07-08 20:58:33 +02:00
import { clipboard } from 'electron';
import Button from 'component/button';
type Props = {
shortUrl: ?string,
uri: string,
doToast: ({ message: string }) => void,
2019-11-22 22:13:00 +01:00
inline?: boolean,
noShortUrl?: boolean,
2019-07-08 20:58:33 +02:00
};
function ClaimUri(props: Props) {
const { shortUrl, uri, doToast, inline = false, noShortUrl = false } = props;
2019-07-08 20:58:33 +02:00
return (
<Button
2019-11-22 22:13:00 +01:00
className={classnames('media__uri', { 'media__uri--inline': inline })}
2019-07-08 20:58:33 +02:00
button="alt"
label={noShortUrl ? uri : shortUrl || uri}
2019-07-08 20:58:33 +02:00
onClick={() => {
clipboard.writeText(shortUrl || uri);
doToast({
message: __('Copied'),
});
}}
/>
);
}
export default ClaimUri;