import { Check, Clipboard } from "lucide-react"; import * as React from "react"; import { useTranslation } from "react-i18next"; import { SendouButton } from "~/components/elements/Button"; import { Label } from "~/components/Label"; import { useCopyToClipboard } from "~/hooks/useCopyToClipboard"; import styles from "./InviteLinkInput.module.css"; /** A labeled read-only invite link with a copy to clipboard button. */ export function InviteLinkInput({ link, label, }: { link: string; /** Overrides the default "Invite link" label. */ label?: string; }) { const { t } = useTranslation(["common"]); const id = React.useId(); const { copyToClipboard, copySuccess } = useCopyToClipboard(); return (
e.currentTarget.select()} data-testid="invite-link-input" /> copyToClipboard(link)} icon={copySuccess ? : } aria-label={t("common:actions.copyToClipboard")} data-testid="copy-invite-link-button" />
); }