import { Component, JSX, createRef } from "preact"; import { MarginInline } from "./MarginInline"; import { addClipboardNotifications } from "../pageUtils"; import ClipboardJS from "clipboard"; import i18next from "i18next"; export type CopyableInputBoxProps = { text: string; copyable?: boolean; }; export class CopyableInputBox extends Component { copyIconRef = createRef(); inputBoxRef = createRef(); componentDidMount(): void { const clipboard = new ClipboardJS(this.copyIconRef.current); addClipboardNotifications(clipboard, 600); } render(): JSX.Element { return (
{this.props.copyable && ( )}
); } }