1- import { ClipboardButton , Link as UIKitLink } from '@gravity-ui/uikit' ;
1+ import React from 'react' ;
2+
3+ import { CircleInfo } from '@gravity-ui/icons' ;
4+ import { Button , ClipboardButton , Icon , Popover , Link as UIKitLink } from '@gravity-ui/uikit' ;
25
36import { EFlag } from '../../types/api/enums' ;
47import { cn } from '../../utils/cn' ;
@@ -25,6 +28,7 @@ interface EntityStatusProps {
2528 withLeftTrim ?: boolean ;
2629
2730 hasClipboardButton ?: boolean ;
31+ infoPopoverContent ?: React . ReactNode ;
2832 clipboardButtonAlwaysVisible ?: boolean ;
2933
3034 className ?: string ;
@@ -45,10 +49,13 @@ export function EntityStatus({
4549 withLeftTrim = false ,
4650
4751 hasClipboardButton,
52+ infoPopoverContent,
4853 clipboardButtonAlwaysVisible = false ,
4954
5055 className,
5156} : EntityStatusProps ) {
57+ const [ infoIconHovered , setInfoIconHovered ] = React . useState ( false ) ;
58+
5259 const renderIcon = ( ) => {
5360 if ( ! showStatus ) {
5461 return null ;
@@ -90,24 +97,51 @@ export function EntityStatus({
9097 </ span >
9198 ) }
9299 { ( path || name ) && (
93- < div className = { b ( 'wrapper' , { 'with-button' : hasClipboardButton } ) } >
100+ < div
101+ className = { b ( 'wrapper' , {
102+ 'with-clipboard-button' : hasClipboardButton ,
103+ 'with-info-button' : Boolean ( infoPopoverContent ) ,
104+ } ) }
105+ >
94106 < span className = { b ( 'link' , { 'with-left-trim' : withLeftTrim } ) } title = { name } >
95107 { renderLink ( ) }
96108 </ span >
97- { hasClipboardButton && (
109+ { ( hasClipboardButton || infoPopoverContent ) && (
98110 < div
99111 className = { b ( 'controls-wrapper' , {
100- visible : clipboardButtonAlwaysVisible ,
112+ visible : clipboardButtonAlwaysVisible || infoIconHovered ,
101113 } ) }
102114 >
103- < ClipboardButton
104- text = { name }
105- size = "xs"
106- view = "normal"
107- className = { b ( 'clipboard-button' , {
108- visible : clipboardButtonAlwaysVisible ,
109- } ) }
110- />
115+ { infoPopoverContent && (
116+ < Popover
117+ className = { b ( 'info-popover' ) }
118+ content = { infoPopoverContent }
119+ tooltipOffset = { [ - 4 , 4 ] }
120+ placement = { [ 'top-start' , 'bottom-start' ] }
121+ onOpenChange = { ( visible ) => setInfoIconHovered ( visible ) }
122+ >
123+ < Button view = "normal" size = "xs" >
124+ < Icon
125+ data = { CircleInfo }
126+ size = "12"
127+ className = { b ( 'info-icon' , {
128+ visible :
129+ clipboardButtonAlwaysVisible || infoIconHovered ,
130+ } ) }
131+ />
132+ </ Button >
133+ </ Popover >
134+ ) }
135+ { hasClipboardButton && (
136+ < ClipboardButton
137+ text = { name }
138+ size = "xs"
139+ view = "normal"
140+ className = { b ( 'clipboard-button' , {
141+ visible : clipboardButtonAlwaysVisible || infoIconHovered ,
142+ } ) }
143+ />
144+ ) }
111145 </ div >
112146 ) }
113147 </ div >
0 commit comments