11import React from 'react' ;
22
3- import { CircleXmarkFill , TriangleExclamationFill } from '@gravity-ui/icons ' ;
4- import { Checkbox , Dialog , Icon } from '@gravity-ui/uikit' ;
3+ import { Alert , Checkbox , Dialog , Flex , Text } from '@gravity-ui/uikit ' ;
4+ import type { ButtonView } from '@gravity-ui/uikit' ;
55
66import { ResultIssues } from '../../containers/Tenant/Query/Issues/Issues' ;
77import type { IResponseError } from '../../types/api/error' ;
@@ -36,9 +36,12 @@ const parseError = (error: unknown) => {
3636interface CriticalActionDialogProps < T > {
3737 visible : boolean ;
3838 header ?: React . ReactNode ;
39- text ?: string ;
39+ description ?: string ;
40+ warningText ?: string ;
4041 withRetry ?: boolean ;
4142 retryButtonText ?: string ;
43+ applyButtonText ?: string ;
44+ applyButtonView ?: ButtonView ;
4245 withCheckBox ?: boolean ;
4346 onClose : VoidFunction ;
4447 onConfirm : ( isRetry ?: boolean ) => Promise < T > ;
@@ -49,9 +52,12 @@ interface CriticalActionDialogProps<T> {
4952export function CriticalActionDialog < T > ( {
5053 visible,
5154 header,
52- text,
55+ description,
56+ warningText,
5357 withRetry,
5458 retryButtonText,
59+ applyButtonText = criticalActionDialogKeyset ( 'button-confirm' ) ,
60+ applyButtonView,
5561 withCheckBox,
5662 onClose,
5763 onConfirm,
@@ -101,13 +107,8 @@ export function CriticalActionDialog<T>({
101107 return (
102108 < React . Fragment >
103109 < Dialog . Header caption = { header } />
104- < Dialog . Body className = { b ( 'body' ) } >
105- < div className = { b ( 'body-message' , { error : true } ) } >
106- < span className = { b ( 'error-icon' ) } >
107- < CircleXmarkFill width = "24" height = "22" />
108- </ span >
109- { parseError ( error ) }
110- </ div >
110+ < Dialog . Body >
111+ < Alert theme = "danger" message = { parseError ( error ) } view = "outlined" />
111112 </ Dialog . Body >
112113
113114 < Dialog . Footer
@@ -130,23 +131,24 @@ export function CriticalActionDialog<T>({
130131 < React . Fragment >
131132 < Dialog . Header caption = { header } />
132133
133- < Dialog . Body className = { b ( 'body' ) } >
134- < div className = { b ( 'body-message' , { warning : true } ) } >
135- < span className = { b ( 'warning-icon' ) } >
136- < Icon data = { TriangleExclamationFill } size = { 24 } />
137- </ span >
138- { text }
139- </ div >
140-
141- { renderCheckBox ( ) }
134+ < Dialog . Body >
135+ < Flex direction = "column" gap = { 4 } >
136+ { description && < Text as = "div" > { description } </ Text > }
137+ { warningText && < Alert theme = "warning" message = { warningText } /> }
138+ { renderCheckBox ( ) }
139+ </ Flex >
142140 </ Dialog . Body >
143141
144142 < Dialog . Footer
145143 loading = { isLoading }
146144 preset = "default"
147- textButtonApply = { criticalActionDialogKeyset ( 'button-confirm' ) }
145+ textButtonApply = { applyButtonText }
148146 textButtonCancel = { criticalActionDialogKeyset ( 'button-cancel' ) }
149- propsButtonApply = { { type : 'submit' , disabled : withCheckBox && ! checkBoxChecked } }
147+ propsButtonApply = { {
148+ type : 'submit' ,
149+ disabled : withCheckBox && ! checkBoxChecked ,
150+ view : applyButtonView ,
151+ } }
150152 onClickButtonCancel = { onClose }
151153 onClickButtonApply = { ( ) => onApply ( ) }
152154 />
0 commit comments