Skip to content

Commit ae845e5

Browse files
committed
feat: complete mobile dialog
1 parent 3c1550b commit ae845e5

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

src/components/Dialog/Dialog.tsx

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import ButtonWithLoading, {
1010
type ButtonWithLoadingProps,
1111
} from '../common/ButtonWithLoading';
1212
import DialogTransition from '../common/DialogTransition';
13+
import { useAppContext } from '@/hooks/useAppContext';
1314

1415
export interface DialogProps extends MuiDialogProps {
1516
dialogContentProps?: DialogContentProps;
@@ -23,8 +24,44 @@ const Dialog: FC<DialogProps> = ({
2324
closeButtonDisabled = false,
2425
...props
2526
}) => {
27+
const { isMobile } = useAppContext();
2628
return (
27-
<MuiDialog TransitionComponent={DialogTransition} {...props}>
29+
<MuiDialog
30+
TransitionComponent={DialogTransition}
31+
{...props}
32+
PaperProps={{
33+
...props.PaperProps,
34+
sx: {
35+
...props?.PaperProps?.sx,
36+
...(isMobile
37+
? {
38+
margin: 0,
39+
width: '100%',
40+
maxWidth: '100%',
41+
}
42+
: {}),
43+
},
44+
}}
45+
slotProps={{
46+
root: isMobile
47+
? {
48+
style: {
49+
zIndex: 2000,
50+
},
51+
}
52+
: {},
53+
}}
54+
sx={{
55+
...props.sx,
56+
...(isMobile
57+
? {
58+
'& .MuiDialog-container': {
59+
alignItems: 'flex-end',
60+
},
61+
}
62+
: {}),
63+
}}
64+
>
2865
<DialogTitle
2966
sx={{
3067
display: 'flex',

0 commit comments

Comments
 (0)