17 lines
704 B
TypeScript
17 lines
704 B
TypeScript
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>
|
|
);
|
|
}
|