-
Notifications
You must be signed in to change notification settings - Fork 17
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 #293 from shreyas1434shinde/teachingCenter
Issue #PS-798 fix: UI Reusable components (branch 2)
- Loading branch information
Showing
11 changed files
with
825 additions
and
21 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,84 @@ | ||
import * as React from 'react'; | ||
|
||
import Box from '@mui/material/Box'; | ||
import Drawer from '@mui/material/Drawer'; | ||
import DropOutModal from './DropOutModal'; | ||
import List from '@mui/material/List'; | ||
import ListItem from '@mui/material/ListItem'; | ||
import ListItemButton from '@mui/material/ListItemButton'; | ||
import ListItemIcon from '@mui/material/ListItemIcon'; | ||
import ListItemText from '@mui/material/ListItemText'; | ||
import { useTheme } from '@mui/material/styles'; | ||
import { useTranslation } from 'next-i18next'; | ||
|
||
type Anchor = 'bottom'; | ||
|
||
interface BottomDrawerProps { | ||
toggleDrawer: ( | ||
anchor: Anchor, | ||
open: boolean | ||
) => (event: React.MouseEvent) => void; | ||
state: { [key in Anchor]?: boolean }; | ||
optionList: { | ||
label: string; | ||
icon: React.ReactNode; | ||
name: string; | ||
}[]; | ||
listItemClick: (event: React.MouseEvent, name: string) => void; | ||
} | ||
|
||
export default function BottomDrawer({ | ||
toggleDrawer, | ||
state, | ||
optionList, | ||
listItemClick, | ||
}: BottomDrawerProps) { | ||
const { t } = useTranslation(); | ||
const theme = useTheme<any>(); | ||
|
||
const list = (anchor: Anchor) => ( | ||
<Box | ||
sx={{ | ||
width: 'auto', | ||
}} | ||
role="presentation" | ||
> | ||
<Box | ||
sx={{ | ||
padding: '30px 40px 40px', | ||
display: 'flex', | ||
justifyContent: 'center', | ||
}} | ||
onClick={toggleDrawer(anchor, false)} | ||
> | ||
<Box className="bg-grey"></Box> | ||
</Box> | ||
<List> | ||
{optionList.map(({ label, icon, name }, index) => ( | ||
<ListItem disablePadding key={index}> | ||
<ListItemButton | ||
sx={{ | ||
borderBottom: '1px solid #D0C5B4', | ||
padding: '20px', | ||
fontSize: '14px', | ||
color: theme.palette.warning['300'], | ||
}} | ||
onClick={(e) => listItemClick(e, name)} | ||
> | ||
<ListItemIcon>{icon}</ListItemIcon> | ||
<ListItemText primary={label} /> | ||
</ListItemButton> | ||
</ListItem> | ||
))} | ||
</List> | ||
</Box> | ||
); | ||
|
||
return ( | ||
<div> | ||
<Drawer anchor="bottom" open={state.bottom} className="modal-bottom"> | ||
{list('bottom')} | ||
</Drawer> | ||
</div> | ||
); | ||
} |
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,132 @@ | ||
import * as React from 'react'; | ||
|
||
import { | ||
Box, | ||
Button, | ||
Divider, | ||
FormControl, | ||
InputLabel, | ||
MenuItem, | ||
Modal, | ||
OutlinedInput, | ||
Select, | ||
SelectChangeEvent, | ||
Typography, | ||
} from '@mui/material'; | ||
import { Theme, useTheme } from '@mui/material/styles'; | ||
|
||
import CloseIcon from '@mui/icons-material/Close'; | ||
import { useTranslation } from 'next-i18next'; | ||
|
||
interface DropOutModalProps { | ||
open: boolean; | ||
onClose: (confirmed: boolean) => void; | ||
} | ||
|
||
function DropOutModal({ open, onClose }: DropOutModalProps) { | ||
const { t } = useTranslation(); | ||
|
||
const style = { | ||
position: 'absolute', | ||
top: '50%', | ||
left: '50%', | ||
transform: 'translate(-50%, -50%)', | ||
width: '85%', | ||
boxShadow: 24, | ||
bgcolor: '#fff', | ||
borderRadius: '24px', | ||
'@media (min-width: 600px)': { | ||
width: '450px', | ||
}, | ||
}; | ||
|
||
const theme = useTheme<any>(); | ||
|
||
return ( | ||
<React.Fragment> | ||
<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.DROP_OUT')} | ||
</Typography> | ||
</Box> | ||
<CloseIcon | ||
sx={{ | ||
cursor: 'pointer', | ||
color: theme.palette.warning['A200'], | ||
}} | ||
onClick={() => onClose(false)} | ||
/> | ||
</Box> | ||
<Divider /> | ||
<Box sx={{ padding: '10px 18px' }}> | ||
<FormControl sx={{ mt: 1, width: '100%' }}> | ||
<InputLabel | ||
sx={{ fontSize: '16px', color: theme.palette.warning['300'] }} | ||
id="demo-multiple-name-label" | ||
> | ||
{t('COMMON.REASON_FOR_DROPOUT')} | ||
</InputLabel> | ||
<Select | ||
labelId="demo-multiple-name-label" | ||
id="demo-multiple-name" | ||
input={<OutlinedInput label="Reason for Dropout" />} | ||
> | ||
<MenuItem | ||
value="Unable to cope with studies" | ||
sx={{ | ||
fontSize: '16px', | ||
color: theme.palette.warning['300'], | ||
}} | ||
> | ||
Unable to cope with studies {/* come from API */} | ||
</MenuItem> | ||
<MenuItem | ||
value="Family responsibilities" | ||
sx={{ | ||
fontSize: '16px', | ||
color: theme.palette.warning['300'], | ||
}} | ||
> | ||
Family responsibilities {/* come from API */} | ||
</MenuItem> | ||
</Select> | ||
</FormControl> | ||
</Box> | ||
<Box mt={1.5}> | ||
<Divider /> | ||
</Box> | ||
<Box p={'18px'}> | ||
<Button | ||
className="w-100" | ||
sx={{ boxShadow: 'none' }} | ||
variant="contained" | ||
onClick={() => onClose(true)} | ||
> | ||
{t('COMMON.MARK_DROP_OUT')} | ||
</Button> | ||
</Box> | ||
</Box> | ||
</Modal> | ||
</React.Fragment> | ||
); | ||
} | ||
|
||
export default DropOutModal; |
Oops, something went wrong.