Delete legacy CopyableInput component
This commit is contained in:
parent
82aad21900
commit
9c7274ee01
2 changed files with 3 additions and 30 deletions
|
@ -1,8 +1,8 @@
|
||||||
import { QRCodeCanvas as QRCode } from 'qrcode.react';
|
import { QRCodeCanvas as QRCode } from 'qrcode.react';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
|
import CopyableInput from 'soapbox/components/copyable-input';
|
||||||
import Icon from 'soapbox/components/icon';
|
import Icon from 'soapbox/components/icon';
|
||||||
import { CopyableInput } from 'soapbox/features/forms';
|
|
||||||
|
|
||||||
import { getExplorerUrl } from '../utils/block_explorer';
|
import { getExplorerUrl } from '../utils/block_explorer';
|
||||||
import { getTitle } from '../utils/coin_db';
|
import { getTitle } from '../utils/coin_db';
|
||||||
|
@ -38,9 +38,8 @@ const DetailedCryptoAddress: React.FC<IDetailedCryptoAddress> = ({ address, tick
|
||||||
<div className='crypto-address__qrcode'>
|
<div className='crypto-address__qrcode'>
|
||||||
<QRCode value={address} />
|
<QRCode value={address} />
|
||||||
</div>
|
</div>
|
||||||
<div className='crypto-address__address simple_form'>
|
|
||||||
<CopyableInput value={address} />
|
<CopyableInput value={address} />
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -287,29 +287,3 @@ export const FileChooserLogo: React.FC<IFileChooserLogo> = props => (
|
||||||
FileChooserLogo.defaultProps = {
|
FileChooserLogo.defaultProps = {
|
||||||
accept: ['image/svg', 'image/png'],
|
accept: ['image/svg', 'image/png'],
|
||||||
};
|
};
|
||||||
|
|
||||||
interface ICopyableInput {
|
|
||||||
value: string,
|
|
||||||
}
|
|
||||||
|
|
||||||
export const CopyableInput: React.FC<ICopyableInput> = ({ value }) => {
|
|
||||||
const node = useRef<HTMLInputElement>(null);
|
|
||||||
|
|
||||||
const handleCopyClick: React.MouseEventHandler = () => {
|
|
||||||
if (!node.current) return;
|
|
||||||
|
|
||||||
node.current.select();
|
|
||||||
node.current.setSelectionRange(0, 99999);
|
|
||||||
|
|
||||||
document.execCommand('copy');
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='copyable-input'>
|
|
||||||
<input ref={node} type='text' value={value} readOnly />
|
|
||||||
<button className='p-2 text-white bg-primary-600' onClick={handleCopyClick}>
|
|
||||||
<FormattedMessage id='forms.copy' defaultMessage='Copy' />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
Loading…
Reference in a new issue