mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-23 17:47:24 +00:00
* fix: channel navigation from suggested subscriptions * fix: move subscribe/share buttons below name on channel page * fix: images with weird media type * fix: increase tx amount size on tx table * change: add icons to nav bar * fix: move filewatcher-webpack-plugin into dev dependencies * fix: upgrade button styling * improvement: modal consistency * change: increase svg stroke inside button * fix: more descriptive title on header for wallet balance * fix: minor color/alignment * chore: update lbry-redux
55 lines
1.2 KiB
JavaScript
55 lines
1.2 KiB
JavaScript
// @flow
|
|
import * as ICONS from 'constants/icons';
|
|
import * as React from 'react';
|
|
import { clipboard } from 'electron';
|
|
import { FormRow } from 'component/common/form';
|
|
import Button from 'component/button';
|
|
|
|
type Props = {
|
|
copyable: string,
|
|
doToast: ({ message: string }) => void,
|
|
};
|
|
|
|
export default class CopyableText extends React.PureComponent<Props> {
|
|
constructor() {
|
|
super();
|
|
|
|
this.input = null;
|
|
}
|
|
|
|
input: ?HTMLInputElement;
|
|
|
|
render() {
|
|
const { copyable, doToast } = this.props;
|
|
|
|
return (
|
|
<FormRow verticallyCentered stretch>
|
|
<input
|
|
className="input-copyable form-field__input"
|
|
readOnly
|
|
value={copyable || ''}
|
|
ref={input => {
|
|
this.input = input;
|
|
}}
|
|
onFocus={() => {
|
|
if (this.input) {
|
|
this.input.select();
|
|
}
|
|
}}
|
|
/>
|
|
|
|
<Button
|
|
noPadding
|
|
button="secondary"
|
|
icon={ICONS.CLIPBOARD}
|
|
onClick={() => {
|
|
clipboard.writeText(copyable);
|
|
doToast({
|
|
message: __('Text copied'),
|
|
});
|
|
}}
|
|
/>
|
|
</FormRow>
|
|
);
|
|
}
|
|
}
|