diff --git a/src/renderer/component/copyableText/index.js b/src/renderer/component/copyableText/index.js new file mode 100644 index 000000000..57e7bf9db --- /dev/null +++ b/src/renderer/component/copyableText/index.js @@ -0,0 +1,7 @@ +import { connect } from 'react-redux'; +import { doNotify } from 'lbry-redux'; +import Address from './view'; + +export default connect(null, { + doNotify, +})(Address); diff --git a/src/renderer/component/copyableText/view.jsx b/src/renderer/component/copyableText/view.jsx new file mode 100644 index 000000000..0958c60b2 --- /dev/null +++ b/src/renderer/component/copyableText/view.jsx @@ -0,0 +1,55 @@ +// @flow +import * as React from 'react'; +import { clipboard } from 'electron'; +import { FormRow } from 'component/common/form'; +import Button from 'component/button'; +import * as icons from 'constants/icons'; + +type Props = { + copyable: string, + doNotify: ({ message: string, displayType: Array }) => void, +}; + +export default class CopyableInput extends React.PureComponent { + constructor() { + super(); + + this.input = null; + } + + input: ?HTMLInputElement; + + render() { + const { copyable, doNotify } = this.props; + + return ( + + { + this.input = input; + }} + onFocus={() => { + if (this.input) { + this.input.select(); + } + }} + /> +