Skip to content

Commit 424f3c9

Browse files
committed
fix(modals): change some close button text to cancel
1 parent 0b9c544 commit 424f3c9

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

components/WarningDeleteButton.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export const WarningDeleteButton = ({
7979
{tooltipText === undefined ? content : <Tooltip title={tooltipText}>{content}</Tooltip>}
8080

8181
<ModalWrapper
82+
closeText="Cancel"
8283
id={modalId}
8384
open={open}
8485
submitDisabled={isDeleting}

components/modals/FormikModalWrapper.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ export interface FormikModalWrapperProps extends BaseModalWrapperProps {
1717
* Text displayed in the submit button
1818
*/
1919
submitText: string;
20+
/**
21+
* Text displayed in the close button. Defaults to "Close"
22+
*/
23+
closeText?: string;
2024
/**
2125
* Whether the modal is open
2226
*/
@@ -43,6 +47,7 @@ export const FormikModalWrapper = <Values extends FormikValues>({
4347
id,
4448
title,
4549
submitText,
50+
closeText,
4651
open,
4752
onClose,
4853
children,
@@ -54,6 +59,7 @@ export const FormikModalWrapper = <Values extends FormikValues>({
5459
{({ submitForm, isSubmitting, isValid, ...rest }) => (
5560
<Form style={{ display: "inline" }}>
5661
<ModalWrapper
62+
closeText={closeText}
5763
DialogProps={DialogProps}
5864
id={id}
5965
open={open}

components/modals/ModalWrapper.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ export interface ModalWrapperProps extends BaseModalWrapperProps {
3030
* Whether the primary action should be in a disabled state.
3131
*/
3232
submitDisabled?: boolean;
33+
/**
34+
* Text to be displayed as the close text button. Defaylt is "Close"
35+
*/
36+
closeText?: string;
3337
}
3438

3539
/**
@@ -40,6 +44,7 @@ export const ModalWrapper: React.FC<ModalWrapperProps> = ({
4044
title,
4145
submitText,
4246
submitDisabled,
47+
closeText = "Close",
4348
children,
4449
open,
4550
onClose,
@@ -75,7 +80,7 @@ export const ModalWrapper: React.FC<ModalWrapperProps> = ({
7580
</DialogTitle>
7681
<DialogContent>{children}</DialogContent>
7782
<DialogActions>
78-
<Button onClick={onClose}>Close</Button>
83+
<Button onClick={onClose}>{closeText}</Button>
7984
{!!onSubmit && (
8085
<Button color="primary" disabled={submitDisabled} onClick={onSubmit}>
8186
{submitText}

components/projects/CreateProject/CreateProjectForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ export const CreateProjectForm = ({
253253
};
254254

255255
return modal ? (
256-
<FormikModalWrapper {...modal} {...commonProps}>
256+
<FormikModalWrapper {...modal} {...commonProps} closeText="Cancel">
257257
{children}
258258
</FormikModalWrapper>
259259
) : (

0 commit comments

Comments
 (0)