-
Notifications
You must be signed in to change notification settings - Fork 15
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 #10 from Aar-if/deleteCohort
Issue #PS-1282 feat: Implement the delete center
- Loading branch information
Showing
8 changed files
with
222 additions
and
33 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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,140 @@ | ||
import { | ||
Box, | ||
Button, | ||
Divider, | ||
FormControl, | ||
FormControlLabel, | ||
InputLabel, | ||
Modal, | ||
Radio, | ||
RadioGroup, | ||
TextField, | ||
Typography, | ||
} from '@mui/material'; | ||
import React, { ReactNode, useState } from 'react'; | ||
import { useTheme } from '@mui/material/styles'; | ||
import { useTranslation } from 'next-i18next'; | ||
import CloseIcon from '@mui/icons-material/Close'; | ||
import { showToastMessage } from './Toastify'; | ||
import manageUserStore from '@/store/manageUserStore'; | ||
import { getCohortList } from '@/services/CohortServices'; | ||
|
||
interface SimpleModalProps { | ||
secondaryActionHandler?: () => void; | ||
primaryActionHandler: () => void; | ||
secondaryText?: string; | ||
primaryText: string; | ||
children: ReactNode; | ||
open: boolean; | ||
onClose: () => void; | ||
} | ||
const SimpleModal: React.FC<SimpleModalProps> = ({ | ||
open, | ||
onClose, | ||
primaryText, | ||
secondaryText, | ||
primaryActionHandler, | ||
secondaryActionHandler, | ||
children, | ||
}) => { | ||
const { t } = useTranslation(); | ||
const store = manageUserStore(); | ||
const theme = useTheme<any>(); | ||
const style = { | ||
padding: '20px', | ||
position: 'absolute', | ||
top: '50%', | ||
left: '50%', | ||
transform: 'translate(-50%, -50%)', | ||
width: '85%', | ||
boxShadow: 24, | ||
bgcolor: '#fff', | ||
borderRadius: '16px', | ||
'@media (min-width: 600px)': { | ||
width: '450px', | ||
}, | ||
}; | ||
|
||
return ( | ||
<Modal | ||
open={open} | ||
aria-labelledby="child-modal-title" | ||
aria-describedby="child-modal-description" | ||
> | ||
<Box sx={{ ...style }}> | ||
<Box | ||
display={'flex'} | ||
justifyContent={'space-between'} | ||
sx={{ padding: '18px 16px' }} | ||
> | ||
<Box marginBottom={'0px'}> | ||
<Typography | ||
variant="h2" | ||
sx={{ | ||
color: theme.palette.warning['A200'], | ||
fontSize: '14px', | ||
}} | ||
component="h2" | ||
> | ||
{t('COMMON.DELETE_USER')} | ||
</Typography> | ||
</Box> | ||
<CloseIcon | ||
sx={{ | ||
cursor: 'pointer', | ||
color: theme.palette.warning['A200'], | ||
}} | ||
onClick={onClose} | ||
/> | ||
</Box> | ||
<Divider /> | ||
{children} | ||
<Divider /> | ||
|
||
<Box sx={{ padding: '20px 16px' }}> | ||
{primaryText && ( | ||
<Button | ||
variant="contained" | ||
color="primary" | ||
sx={{ | ||
'&.Mui-disabled': { | ||
backgroundColor: theme?.palette?.primary?.main, | ||
}, | ||
minWidth: '84px', | ||
height: '2.5rem', | ||
padding: theme.spacing(1), | ||
fontWeight: '500', | ||
width: '100%', | ||
}} | ||
onClick={primaryActionHandler} | ||
> | ||
{primaryText} | ||
</Button> | ||
)} | ||
|
||
{secondaryText && ( | ||
<Button | ||
variant="contained" | ||
color="primary" | ||
sx={{ | ||
'&.Mui-disabled': { | ||
backgroundColor: theme?.palette?.primary?.main, | ||
}, | ||
minWidth: '84px', | ||
height: '2.5rem', | ||
padding: theme.spacing(1), | ||
fontWeight: '500', | ||
width: '100%', | ||
}} | ||
onClick={secondaryActionHandler} | ||
> | ||
{secondaryText} | ||
</Button> | ||
)} | ||
</Box> | ||
</Box> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default SimpleModal; |
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