diff --git a/client/src/components/ChangesModal.jsx b/client/src/components/ChangesModal.jsx index 5eff6315..275c4750 100644 --- a/client/src/components/ChangesModal.jsx +++ b/client/src/components/ChangesModal.jsx @@ -1,16 +1,8 @@ -import React from 'react' -import { - Modal, - Box, - Typography, - Grid - } from '@mui/material' - import { StyledButton } from './ProjectForm'; - import { Link } from 'react-router-dom'; - import WarningAmberRoundedIcon from '@mui/icons-material/WarningAmberRounded'; +import { Modal, Box, Typography, Grid, Button } from '@mui/material'; +import { Link } from 'react-router-dom'; +import WarningAmberRoundedIcon from '@mui/icons-material/WarningAmberRounded'; - - const style = { +const style = { position: 'absolute', top: '50%', left: '50%', @@ -22,52 +14,73 @@ import { p: 4, }; +export default function ChangesModal({ + open, + onClose, + handleClose, + destination, +}) { + return ( + + + + + - export default function ChangesModal({open, onClose, handleClose, destination }) { - return ( - - - - - - - - - Wait! You made some changes. - - - Are you sure you want to exit without saving? - - - - - Yes - - - - - No - - + + Wait! You made some changes. + + + Are you sure you want to exit without saving? + + + + + + + - - - ) - } \ No newline at end of file + + + + ); +} diff --git a/client/src/components/ProjectForm.jsx b/client/src/components/ProjectForm.jsx index b21e8b4e..eff754a4 100644 --- a/client/src/components/ProjectForm.jsx +++ b/client/src/components/ProjectForm.jsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import { useState } from 'react'; import { useHistory } from 'react-router-dom'; import { useForm, useFormState } from 'react-hook-form'; import { @@ -12,7 +12,6 @@ import { FormControlLabel, RadioGroup, } from '@mui/material'; -import { styled } from '@mui/material/styles'; import useAuth from '../hooks/useAuth'; import ProjectApiService from '../api/ProjectApiService'; @@ -28,22 +27,6 @@ import ChangesModal from './ChangesModal'; * -the rest are inline */ -export const StyledButton = styled(Button)(({ theme }) => ({ - width: '150px', -})); - -const StyledFormControlLabel = styled(FormControlLabel)(({ theme }) => ({ - width: 'max-content', - '& .MuiFormControlLabel-label': { - fontSize: '14px', - }, -})); - -const StyledRadio = styled(Radio)(({ theme }) => ({ - padding: '0px 0px 0px 0px', - marginRight: '.5rem', -})); - /**Project Form Component * -renders a form for creating and updating a project @@ -145,11 +128,12 @@ export default function ProjectForm({ // Handles the location radio button change. const handleRadioChange = (event) => { + alert(event.target.value); setLocationType(event.target.value); }; // Toggles the project view to edit mode change. - const handleEditMode = (event) => { + const handleEditMode = () => { setEditMode(!editMode); // React hook form method to reset data back to original values. Triggered when Edit Mode is cancelled. reset({ @@ -211,16 +195,16 @@ export default function ProjectForm({ onChange={handleRadioChange} sx={{ mb: 0.5 }} > - } + control={} label="Remote" disabled={isEdit ? !editMode : false} /> - } + control={} label="In-Person" disabled={isEdit ? !editMode : false} /> @@ -242,7 +226,8 @@ export default function ProjectForm({ badge={isEdit ? editIcon() : addIcon()} expandable={true} > -
{ isEdit ? submitEditProject(data) : submitNewProject(data); @@ -268,25 +253,31 @@ export default function ProjectForm({ aria-describedby="modal-modal-description" handleClose={handleClose} /> -
{' '} +
{' '} - {isLoading ? : 'Save'} - + - Close - + ) : ( - - {' '} -
+ + Project Information + {' '} + { isEdit ? submitEditProject(data) : submitNewProject(data); @@ -327,7 +321,7 @@ export default function ProjectForm({ aria-describedby="modal-modal-description" handleClose={handleClose} /> - +
{''}
)}