forked from rajun/ar-test
feat: add copy field
This commit is contained in:
parent
2f02dd1ae5
commit
b0ada303c4
16
app/components/ui/copy-field.tsx
Normal file
16
app/components/ui/copy-field.tsx
Normal 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>
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user