generated from ctc-uci/npo-frontend-vite-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #162 from ctc-uci/157-refactor-archive-events-flow…
…-to-delete-events-flow 157 refactor archive events flow to delete events flow
- Loading branch information
Showing
5 changed files
with
271 additions
and
192 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { | ||
Button, | ||
Modal, | ||
ModalBody, | ||
ModalCloseButton, | ||
ModalContent, | ||
ModalFooter, | ||
ModalOverlay, | ||
} from '@chakra-ui/react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const DeleteEventsModal = ({ isOpen, onClose, events, confirmDelete }) => { | ||
// Function to format event names separated by commas, except the last one | ||
const formattedEventNames = events.map(event => event.name).join(', '); | ||
|
||
// Determine the correct event label based on the number of events | ||
const eventLabel = events.length > 1 ? 'Events' : 'Event'; | ||
|
||
return ( | ||
<Modal isOpen={isOpen} onClose={onClose} isCentered> | ||
<ModalOverlay /> | ||
<ModalContent style={{padding:"30px", borderRadius:"20px"}}> | ||
<ModalCloseButton /> | ||
<ModalBody | ||
padding={6} | ||
textAlign="center" | ||
fontWeight="800" | ||
fontSize="32px" | ||
lineHeight="33.71px" | ||
fontFamily="Avenir, sans-serif" | ||
style={{ display: 'block' }} // Ensure text alignment applies correctly | ||
> | ||
Are you sure you want to delete: {formattedEventNames} {eventLabel}? | ||
</ModalBody> | ||
<ModalFooter justifyContent="center"> | ||
<Button onClick={onClose} mr={3} style={{ backgroundColor: 'white', fondSize:'20px',borderRadius: '5px', color:'#0075FF', border:'1px solid #0075FF', width:'130px'}}>Cancel</Button> | ||
|
||
<Button colorScheme="red" style={{width:'130px', fondSize:'20px'}} onClick={confirmDelete}> | ||
Delete {eventLabel} | ||
</Button> | ||
</ModalFooter> | ||
</ModalContent> | ||
</Modal> | ||
); | ||
}; | ||
|
||
DeleteEventsModal.propTypes = { | ||
isOpen: PropTypes.bool.isRequired, | ||
onClose: PropTypes.func.isRequired, | ||
confirmDelete: PropTypes.func.isRequired, | ||
events: PropTypes.array.isRequired, | ||
}; | ||
|
||
export default DeleteEventsModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.