File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed
Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,10 @@ import { Button } from '@/components/ui/button'
44
55type CopyButtonProps = {
66 value : any
7+ alwaysVisible ?: boolean
78}
89
9- export function CopyButton ( { value } : CopyButtonProps ) {
10+ export function CopyButton ( { value, alwaysVisible = false } : CopyButtonProps ) {
1011 const [ copied , setCopied ] = useState ( false )
1112
1213 const handleCopy = ( ) => {
@@ -20,7 +21,7 @@ export function CopyButton({ value }: CopyButtonProps) {
2021 variant = "ghost"
2122 size = "sm"
2223 onClick = { handleCopy }
23- className = " h-4 w-4 p-0 opacity- 0 group-hover:opacity-100 transition-opacity"
24+ className = { ` h-4 w-4 p-0 transition- opacity ${ alwaysVisible ? 'opacity-100' : 'opacity- 0 group-hover:opacity-100' } ` }
2425 title = "Copy to clipboard"
2526 >
2627 { copied ? < Check className = "h-3 w-3" /> : < Copy className = "h-3 w-3" /> }
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { Button } from '@/components/ui/button'
44import { JsonViewer } from '@/components/JsonViewer'
55import { TooltipProvider } from '@/components/ui/tooltip'
66import { TruncatedColumnName } from '@/components/TruncatedColumnName'
7+ import { CopyButton } from '@/components/CopyButton'
78import { createColumnMetadata } from '@/utils/column-metadata'
89
910const STORAGE_KEY = 'snowplow-micro-json-panel-width'
@@ -110,11 +111,14 @@ export function JsonSidePanel({
110111 { /* Header with title and close button */ }
111112 < div className = "bg-background" >
112113 < div className = "flex items-center justify-between" >
113- < TruncatedColumnName
114- columnMetadata = { createColumnMetadata ( title ) }
115- iconSize = "md"
116- className = "text-lg font-light truncate"
117- />
114+ < div className = "flex items-center gap-2" >
115+ < TruncatedColumnName
116+ columnMetadata = { createColumnMetadata ( title ) }
117+ iconSize = "md"
118+ className = "text-lg font-light truncate"
119+ />
120+ < CopyButton value = { value } alwaysVisible />
121+ </ div >
118122 < Button
119123 variant = "ghost"
120124 size = "sm"
You can’t perform that action at this time.
0 commit comments