diff --git a/app/soapbox/components/copyable-input.tsx b/app/soapbox/components/copyable-input.tsx new file mode 100644 index 000000000..4a42452bb --- /dev/null +++ b/app/soapbox/components/copyable-input.tsx @@ -0,0 +1,42 @@ +import React, { useRef } from 'react'; +import { FormattedMessage } from 'react-intl'; + +import { Button, HStack, Input } from './ui'; + +interface ICopyableInput { + /** Text to be copied. */ + value?: string, +} + +/** An input with copy abilities. */ +const CopyableInput: React.FC = ({ value }) => { + const input = useRef(null); + + const selectInput = () => { + input.current?.select(); + }; + + return ( + + + + + + ); +}; + +export default CopyableInput; diff --git a/app/soapbox/components/ui/button/button.tsx b/app/soapbox/components/ui/button/button.tsx index 15826ff2d..e3ae339fc 100644 --- a/app/soapbox/components/ui/button/button.tsx +++ b/app/soapbox/components/ui/button/button.tsx @@ -1,3 +1,4 @@ +import classNames from 'classnames'; import * as React from 'react'; import { Link } from 'react-router-dom'; @@ -12,8 +13,8 @@ interface IButton { block?: boolean, /** Elements inside the