File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
apps/baseai.dev/src/components/mdx Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change 6
6
} from '@heroicons/react/24/solid' ;
7
7
import { Button } from '../ui/button' ;
8
8
import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard' ;
9
+ import cn from 'mxcn' ;
9
10
10
11
export function InlineCopy ( {
11
12
content,
@@ -15,6 +16,7 @@ export function InlineCopy({
15
16
children : React . ReactNode ;
16
17
} ) {
17
18
const { isCopied, copyToClipboard } = useCopyToClipboard ( { timeout : 2000 } ) ;
19
+ const totalChars = content . length ;
18
20
19
21
const onCopy = ( ) => {
20
22
navigator . clipboard . writeText ( content ) ;
@@ -24,7 +26,7 @@ export function InlineCopy({
24
26
25
27
return (
26
28
< span className = "inline-flex items-center gap-1 whitespace-nowrap" >
27
- < code className = 'w-[90 %] sm:w-full overflow-scroll' > { content } </ code >
29
+ < code className = { cn ( totalChars > 25 && 'w-[50 %] sm:w-full overflow-scroll' ) } > { content } </ code >
28
30
< Button
29
31
variant = "ghost"
30
32
className = "h-4 w-4 p-0 focus:ring-0"
You canβt perform that action at this time.
0 commit comments