Skip to content

Commit cf574e5

Browse files
committed
Add confirmation modals for Add Pet flow
1 parent 0b666b2 commit cf574e5

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { FC } from "react";
2+
import PopupModal from "../../../components/common/PopupModal";
3+
4+
interface AddPetModalProps {
5+
isOpen: boolean; // Whether the modal should be visible
6+
handlePrimaryButtonClick: () => void; // Functionalituy for the first button
7+
handleSecondaryButtonClick: () => void; // Functionality for secondary button
8+
}
9+
10+
const AddPetModal: FC<AddPetModalProps> = ({
11+
isOpen,
12+
handlePrimaryButtonClick,
13+
handleSecondaryButtonClick,
14+
}) => {
15+
return (
16+
<PopupModal
17+
open={isOpen}
18+
title="Add Pet?"
19+
message="Are you sure you want to add this pet? A verification link will be sent to them."
20+
primaryButtonText="Add"
21+
primaryButtonColor="red"
22+
onPrimaryClick={handlePrimaryButtonClick}
23+
secondaryButtonText="Cancel"
24+
onSecondaryClick={handleSecondaryButtonClick}
25+
/>
26+
);
27+
};
28+
29+
export default AddPetModal;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { FC } from "react";
2+
import PopupModal from "../../../components/common/PopupModal";
3+
import { useHistory } from "react-router-dom";
4+
5+
interface QuitEditingModalProps {
6+
isOpen: boolean; // Whether the modal should be visible
7+
handleSecondaryButtonClick: () => void; // Functionality for secondary button
8+
navigateTo: string; // path
9+
}
10+
11+
const QuitEditingModal: FC<QuitEditingModalProps> = ({
12+
isOpen,
13+
handleSecondaryButtonClick,
14+
navigateTo,
15+
}) => {
16+
const history = useHistory();
17+
const handlePrimaryButtonClick = () => {
18+
history.push(navigateTo);
19+
};
20+
return (
21+
<PopupModal
22+
open={isOpen}
23+
title="Quit Editing?"
24+
message="Changes you made so far will not be saved."
25+
primaryButtonText="Leave"
26+
onPrimaryClick={handlePrimaryButtonClick}
27+
primaryButtonColor="red"
28+
secondaryButtonText="Keep Editing"
29+
onSecondaryClick={handleSecondaryButtonClick}
30+
/>
31+
);
32+
};
33+
34+
export default QuitEditingModal;

0 commit comments

Comments
 (0)