Skip to content

Commit 5df3930

Browse files
committed
make confirmation modal customizable
Signed-off-by: Jonathan Winters <[email protected]>
1 parent 69ffdf6 commit 5df3930

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/components/popup/popup-manager.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ import { BehaviorSubject } from 'rxjs';
55
import { PopupProps } from './popup';
66

77
export interface PopupApi {
8-
confirm(title: string, message: string | React.ComponentType): Promise<boolean>;
8+
confirm(
9+
title: string,
10+
message: string | React.ComponentType,
11+
customIcon?: {name: string, color: string},
12+
titleColor?: string,
13+
): Promise<boolean>;
914
prompt(
1015
title: string,
1116
form: (formApi: FormApi) => RenderReturn, settings?: {
@@ -25,7 +30,12 @@ export class PopupManager implements PopupApi {
2530
return this.popupPropsSubject.asObservable();
2631
}
2732

28-
public confirm(title: string, message: string | React.ComponentType): Promise<boolean> {
33+
public confirm(
34+
title: string,
35+
message: string | React.ComponentType,
36+
customIcon?: {name: string, color: string},
37+
titleColor?: string,
38+
): Promise<boolean> {
2939
const content = typeof message === 'string' && (() => (<p>{message}</p>)) || message as React.ComponentType;
3040

3141
return new Promise((resolve) => {
@@ -45,6 +55,8 @@ export class PopupManager implements PopupApi {
4555
<button qe-id='argo-popup-cancel-button' className='argo-button argo-button--base-o' onClick={() => closeAndResolve(false)}>Cancel</button>
4656
</div>
4757
),
58+
titleColor: titleColor ? titleColor : 'normal',
59+
icon: customIcon ? { name: customIcon?.name, color: customIcon?.color} : undefined,
4860
});
4961
});
5062
}

0 commit comments

Comments
 (0)