diff --git a/frontend/src/component/admin/users/LinkField/LinkField.tsx b/frontend/src/component/admin/users/LinkField/LinkField.tsx index 6a60b617d8..d58f22ce8b 100644 --- a/frontend/src/component/admin/users/LinkField/LinkField.tsx +++ b/frontend/src/component/admin/users/LinkField/LinkField.tsx @@ -5,11 +5,24 @@ import useToast from 'hooks/useToast'; interface ILinkFieldProps { inviteLink: string; small?: boolean; + successTitle?: string; + errorTitle?: string; } -export const LinkField = ({ inviteLink, small }: ILinkFieldProps) => { +export const LinkField = ({ + inviteLink, + small, + successTitle = 'Successfully copied invite link.', + errorTitle = 'Could not copy invite link.', +}: ILinkFieldProps) => { const { setToastData } = useToast(); + const setError = () => + setToastData({ + type: 'error', + title: errorTitle, + }); + const handleCopy = () => { try { return navigator.clipboard @@ -17,7 +30,7 @@ export const LinkField = ({ inviteLink, small }: ILinkFieldProps) => { .then(() => { setToastData({ type: 'success', - title: 'Successfully copied invite link.', + title: successTitle, }); }) .catch(() => { @@ -28,12 +41,6 @@ export const LinkField = ({ inviteLink, small }: ILinkFieldProps) => { } }; - const setError = () => - setToastData({ - type: 'error', - title: 'Could not copy invite link.', - }); - return (