lbry-desktop/ui/component/claimUri/view.jsx
Jeremy Kauffman 872259b73a
File downloads and refactoring (#3918)
* am I done?

* post diff

* unused selector cleanup

* missed commit

* mess with button styles

* fix flow

Co-authored-by: Jeremy Kauffman <jeremy@lbry.io>
Co-authored-by: Sean Yesmunt <sean@lbry.io>
2020-04-01 14:43:50 -04:00

34 lines
757 B
JavaScript

// @flow
import React from 'react';
import classnames from 'classnames';
import { clipboard } from 'electron';
import Button from 'component/button';
type Props = {
shortUrl: ?string,
uri: string,
doToast: ({ message: string }) => void,
inline?: boolean,
noShortUrl?: boolean,
};
function ClaimUri(props: Props) {
const { shortUrl, uri, doToast, inline = false, noShortUrl = false } = props;
return (
<Button
button="link"
className={classnames('media__uri', { 'media__uri--inline': inline })}
label={noShortUrl ? uri : shortUrl || uri}
onClick={() => {
clipboard.writeText(shortUrl || uri);
doToast({
message: __('Copied'),
});
}}
/>
);
}
export default ClaimUri;