Skip to content

Commit

Permalink
fix(cancel-operation-btn) replace ambiguous modal button labels
Browse files Browse the repository at this point in the history
  • Loading branch information
lorumic authored and edlerd committed Jun 15, 2023
1 parent 625ec11 commit 5c4dbc4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/components/ConfirmationButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import classnames from "classnames";
import { ButtonAppearance } from "@canonical/react-components/dist/components/Button/Button";

interface Props {
cancelButtonLabel?: string;
className?: string;
confirmButtonAppearance?: ValueOf<typeof ButtonAppearance> | string;
confirmButtonLabel: string;
Expand All @@ -25,6 +26,7 @@ interface Props {
}

const ConfirmationButton: FC<Props> = ({
cancelButtonLabel,
className,
confirmButtonAppearance,
confirmButtonLabel,
Expand Down Expand Up @@ -73,6 +75,7 @@ const ConfirmationButton: FC<Props> = ({
<ConfirmationModal
title={title}
onClose={handleCancelModal}
cancelButtonLabel={cancelButtonLabel}
confirmExtra={confirmExtra}
confirmMessage={confirmMessage}
confirmButtonLabel={confirmButtonLabel}
Expand Down
4 changes: 3 additions & 1 deletion src/components/ConfirmationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Button, Modal, ValueOf } from "@canonical/react-components";
import { ButtonAppearance } from "@canonical/react-components/dist/components/Button/Button";

interface Props {
cancelButtonLabel?: string;
confirmButtonAppearance?: ValueOf<typeof ButtonAppearance> | string;
confirmButtonLabel: string;
confirmExtra?: ReactNode;
Expand All @@ -14,6 +15,7 @@ interface Props {
}

const ConfirmationModal: FC<Props> = ({
cancelButtonLabel,
confirmButtonAppearance = "negative",
confirmButtonLabel,
confirmExtra,
Expand All @@ -31,7 +33,7 @@ const ConfirmationModal: FC<Props> = ({
<>
{confirmExtra}
<Button className="u-no-margin--bottom" onClick={onClose}>
Cancel
{cancelButtonLabel ?? "Cancel"}
</Button>
<Button
appearance={confirmButtonAppearance}
Expand Down
3 changes: 2 additions & 1 deletion src/pages/operations/actions/CancelOperationBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ const CancelOperationBtn: FC<Props> = ({ operation }) => {
toggleAppearance=""
isLoading={isLoading}
title="Confirm cancel"
cancelButtonLabel="No"
confirmMessage="Are you sure you want to cancel the operation?"
confirmButtonLabel="Cancel"
confirmButtonLabel="Yes, cancel operation"
toggleCaption="Cancel"
onConfirm={handleCancel}
isDisabled={!operation.may_cancel}
Expand Down

0 comments on commit 5c4dbc4

Please sign in to comment.