From c2f4e4a601f08e0eaba1861b1dc50aced13eb179 Mon Sep 17 00:00:00 2001 From: Katy Huang Date: Thu, 18 Apr 2024 00:16:00 -0700 Subject: [PATCH 1/2] fix: modal styling + optional email --- .../RegisterGuestModal/RegisterGuestModal.jsx | 47 +++++++++++-------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/src/components/RegisterGuestModal/RegisterGuestModal.jsx b/src/components/RegisterGuestModal/RegisterGuestModal.jsx index 6358c81..a1891d7 100644 --- a/src/components/RegisterGuestModal/RegisterGuestModal.jsx +++ b/src/components/RegisterGuestModal/RegisterGuestModal.jsx @@ -21,7 +21,10 @@ import { Link, useDisclosure, Text, + InputGroup, + InputLeftElement, } from '@chakra-ui/react'; +import { IoMdPeople } from 'react-icons/io'; const RegisterGuestModal = ({ isOpen, onClose, eventId }) => { const [waiverText, setWaiverText] = useState(''); @@ -37,7 +40,7 @@ const RegisterGuestModal = ({ isOpen, onClose, eventId }) => { const volunteerObject = yup.object().shape({ first_name: yup.string().required('First name is required'), last_name: yup.string().required('Last name is required'), - email: yup.string().email('Invalid email format').nullable(), + email: yup.string().email('Invalid email format').nullable().notRequired(), waiver: yup .boolean() .oneOf([true], 'You must accept the terms and conditions') @@ -67,12 +70,11 @@ const RegisterGuestModal = ({ isOpen, onClose, eventId }) => { formState: { errors }, } = useForm({ defaultValues: volunteerData, resolver: yupResolver(volunteerObject) }); - const isFormFilled = () => { + const isFormIncomplete = () => { return ( - volunteerData.first_name == '' || - volunteerData.last_name == '' || - volunteerData.waiver == false || - volunteerData.email === null // Considering email can be null + volunteerData.first_name === '' || + volunteerData.last_name === '' || + volunteerData.waiver === false ); }; @@ -190,19 +192,24 @@ const RegisterGuestModal = ({ isOpen, onClose, eventId }) => { Party size - - setVolunteerData(prevState => ({ - ...prevState, - party_number: e.target.value, - })) - } - /> + + + + + + setVolunteerData(prevState => ({ + ...prevState, + party_number: e.target.value, + })) + } + /> + @@ -337,7 +344,7 @@ const RegisterGuestModal = ({ isOpen, onClose, eventId }) => { h="50px" style={{ borderRadius: '12px' }} _hover={{ bg: '#002B99' }} - isDisabled={isFormFilled()} + isDisabled={isFormIncomplete()} > Add Volunteer From 13fa95ce1057a12f4796955b49c56cc05947f78f Mon Sep 17 00:00:00 2001 From: Katy Huang Date: Thu, 18 Apr 2024 01:40:09 -0700 Subject: [PATCH 2/2] style: remove hyper link --- src/components/RegisterGuestModal/RegisterGuestModal.jsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/components/RegisterGuestModal/RegisterGuestModal.jsx b/src/components/RegisterGuestModal/RegisterGuestModal.jsx index a1891d7..3d7b6f0 100644 --- a/src/components/RegisterGuestModal/RegisterGuestModal.jsx +++ b/src/components/RegisterGuestModal/RegisterGuestModal.jsx @@ -18,7 +18,6 @@ import { Checkbox, Grid, GridItem, - Link, useDisclosure, Text, InputGroup, @@ -60,7 +59,7 @@ const RegisterGuestModal = ({ isOpen, onClose, eventId }) => { const { isOpen: isAgreementOpen, - onOpen: onAgreementOpen, + // onOpen: onAgreementOpen, onClose: onAgreementClose, } = useDisclosure(); @@ -314,10 +313,7 @@ const RegisterGuestModal = ({ isOpen, onClose, eventId }) => { })) } > - I agree to the{' '} - - terms and conditions - + I agree to the terms and conditions {errors.waiver && {errors.waiver.message}}