mirror of
https://github.com/documenso/documenso.git
synced 2025-11-12 07:43:16 +10:00
33 lines
773 B
TypeScript
33 lines
773 B
TypeScript
'use client';
|
|
|
|
import { useCopyToClipboard } from '@documenso/lib/client-only/hooks/use-copy-to-clipboard';
|
|
import { useToast } from '@documenso/ui/primitives/use-toast';
|
|
|
|
export type PasswordRevealProps = {
|
|
password: string;
|
|
};
|
|
|
|
export const PasswordReveal = ({ password }: PasswordRevealProps) => {
|
|
const { toast } = useToast();
|
|
const [, copy] = useCopyToClipboard();
|
|
|
|
const onCopyClick = () => {
|
|
void copy(password).then(() => {
|
|
toast({
|
|
title: 'Copied to clipboard',
|
|
description: 'Your password has been copied to your clipboard.',
|
|
});
|
|
});
|
|
};
|
|
|
|
return (
|
|
<button
|
|
type="button"
|
|
className="px-2 blur-sm hover:opacity-50 hover:blur-none"
|
|
onClick={onCopyClick}
|
|
>
|
|
{password}
|
|
</button>
|
|
);
|
|
};
|