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,49 @@ 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+ placement = { [ 'top-start' , 'bottom-start' ] }
120+ onOpenChange = { ( visible ) => setInfoIconHovered ( visible ) }
121+ >
122+ < Button view = "normal" size = "xs" >
123+ < Icon
124+ data = { CircleInfo }
125+ className = { b ( 'info-icon' , {
126+ visible :
127+ clipboardButtonAlwaysVisible || infoIconHovered ,
128+ } ) }
129+ />
130+ </ Button >
131+ </ Popover >
132+ ) }
133+ { hasClipboardButton && (
134+ < ClipboardButton
135+ text = { name }
136+ size = "xs"
137+ view = "normal"
138+ className = { b ( 'clipboard-button' , {
139+ visible : clipboardButtonAlwaysVisible || infoIconHovered ,
140+ } ) }
141+ />
142+ ) }
111143 </ div >
112144 ) }
113145 </ div >
0 commit comments