forked from opensearch-project/observability
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
opensearch-project#320: Add clear modal for friction
Signed-off-by: Eugene Lee <eugenesk@amazon.com>
- Loading branch information
1 parent
5819a13
commit 2d9a591
Showing
3 changed files
with
80 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...rvability/public/components/application_analytics/components/helpers/modal_containers.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { | ||
EuiOverlayMask, | ||
EuiConfirmModal, | ||
} from '@elastic/eui'; | ||
|
||
/* The file contains helper functions for modal layouts | ||
* getDeleteModal - returns a confirm-modal with clear option | ||
*/ | ||
|
||
export const getClearModal = ( | ||
onCancel: ( | ||
event?: React.KeyboardEvent<HTMLDivElement> | React.MouseEvent<HTMLButtonElement, MouseEvent> | ||
) => void, | ||
onConfirm: (event?: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void, | ||
title: string, | ||
message: string, | ||
confirmMessage?: string | ||
) => { | ||
return ( | ||
<EuiOverlayMask> | ||
<EuiConfirmModal | ||
title={title} | ||
onCancel={onCancel} | ||
onConfirm={onConfirm} | ||
cancelButtonText="Cancel" | ||
confirmButtonText={confirmMessage || 'Delete'} | ||
buttonColor="danger" | ||
defaultFocusedButton="confirm" | ||
> | ||
{message} | ||
</EuiConfirmModal> | ||
</EuiOverlayMask> | ||
); | ||
}; |