minor ui improvements for profile
This commit is contained in:
30
apps/dashboard/src/components/click-to-copy.tsx
Normal file
30
apps/dashboard/src/components/click-to-copy.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
'use client';
|
||||
|
||||
import { clipboard } from '@/utils/clipboard';
|
||||
import { toast } from 'sonner';
|
||||
|
||||
import { Tooltiper } from './ui/tooltip';
|
||||
|
||||
type Props = {
|
||||
children: React.ReactNode;
|
||||
className?: string;
|
||||
value: string;
|
||||
};
|
||||
|
||||
const ClickToCopy = ({ children, value }: Props) => {
|
||||
return (
|
||||
<Tooltiper
|
||||
content="Click to copy"
|
||||
asChild
|
||||
className="cursor-pointer"
|
||||
onClick={() => {
|
||||
clipboard(value);
|
||||
toast('Copied to clipboard');
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</Tooltiper>
|
||||
);
|
||||
};
|
||||
|
||||
export default ClickToCopy;
|
||||
Reference in New Issue
Block a user