Skip to content

Commit 5269223

Browse files
committed
add ability to change canceltext in confirmdialog
1 parent 79e25d4 commit 5269223

2 files changed

Lines changed: 48 additions & 1 deletion

File tree

src/client/src/core/BugConfirmDialog.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const BugConfirmDialog = ({
77
onConfirm,
88
onDismiss,
99
confirmButtonText = "Confirm",
10+
cancelButtonText = "Cancel",
1011
sx = {},
1112
}) => {
1213
const getMessage = () => {
@@ -26,7 +27,7 @@ const BugConfirmDialog = ({
2627
<DialogTitle>{title}</DialogTitle>
2728
<DialogContent>{getMessage()}</DialogContent>
2829
<DialogActions>
29-
<Button onClick={onDismiss}>Cancel</Button>
30+
<Button onClick={onDismiss}>{cancelButtonText}</Button>
3031
<Button color="primary" onClick={onConfirm}>
3132
{confirmButtonText}
3233
</Button>

src/client/src/stories/BugConfirmDialog.stories.jsx

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,52 @@ export default function MyComponent() {
6565
title: "Confirm your action",
6666
message: "Are you sure you want to do this thing?",
6767
confirmButtonText: "Confirm",
68+
cancelButtonText: "Cancel",
69+
open: true,
70+
sx: {},
71+
},
72+
73+
argTypes: {
74+
title: {
75+
description: "The title to be displayed in the dialog",
76+
table: {
77+
type: { summary: "string" },
78+
defaultValue: { summary: "Confirm" },
79+
},
80+
},
81+
message: {
82+
description: "The main body message to be displayed",
83+
table: {
84+
type: { summary: "string" },
85+
defaultValue: { summary: "" },
86+
},
87+
},
88+
cancelButtonText: {
89+
description: "The label to be displayed on the 'cancel' button",
90+
table: {
91+
type: { summary: "string" },
92+
defaultValue: { summary: "Cancel" },
93+
},
94+
},
95+
confirmButtonText: {
96+
description: "The label to be displayed on the 'confirm' button",
97+
table: {
98+
type: { summary: "string" },
99+
defaultValue: { summary: "Confirm" },
100+
},
101+
},
102+
sx: {
103+
description: "An object containing style overrides - see MaterialUI docs for options",
104+
table: {
105+
type: { summary: "object" },
106+
defaultValue: { summary: "{}" },
107+
},
108+
},
109+
open: {
110+
table: {
111+
disable: true,
112+
},
113+
},
68114
},
69115
};
70116

0 commit comments

Comments
 (0)