feat: add copy field

This commit is contained in:
rajun 2026-10-27 16:28:55 +05:30
parent 2f02dd1ae5
commit b0ada303c4

View File

@ -0,0 +1,16 @@
import { Button } from '~/components/ui/button';
import { Text } from '~/components/ui/text';
import { copyToClipboard } from '~/lib/browser';
export function CopyField({ value, label }: { value: string; label: string }) {
return (
<div className='flex h-[38px] items-center gap-2 rounded-control bg-background pr-1.5 pl-3 ring-1 ring-inset ring-border-subtle'>
<Text as='span' variant='mono' truncate className='flex-1 select-all'>
{value}
</Text>
<Button variant='secondary' size='sm' className='h-7 rounded-option ring-0' onClick={() => copyToClipboard(value, label)}>
Copy
</Button>
</div>
);
}