File tree Expand file tree Collapse file tree 2 files changed +63
-0
lines changed
frontend/src/features/pet-profile/pages Expand file tree Collapse file tree 2 files changed +63
-0
lines changed Original file line number Diff line number Diff line change 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 ;
Original file line number Diff line number Diff line change 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 ;
You can’t perform that action at this time.
0 commit comments