|
| 1 | +import React from 'react'; |
| 2 | +import { Dialog, DialogContent, Grid, Box, Typography, Button, IconButton, Skeleton, useTheme } from '@mui/material'; |
| 3 | +import GitHubIcon from '@mui/icons-material/GitHub'; |
| 4 | +import GoogleIcon from '@mui/icons-material/Google'; |
| 5 | +import AccountCircleIcon from '@mui/icons-material/AccountCircle'; |
| 6 | +import CloseIcon from '@mui/icons-material/Close'; |
| 7 | + |
| 8 | +export interface AuthModalProps { |
| 9 | + open: boolean; |
| 10 | + onClose: () => void; |
| 11 | + onSignIn: (provider: 'devsoc' | 'google' | 'github' | 'guest') => void; |
| 12 | + loading?: boolean; |
| 13 | +} |
| 14 | + |
| 15 | +export default function LoginDialog({ open, onClose, onSignIn, loading = false }: AuthModalProps) { |
| 16 | + return ( |
| 17 | + <Dialog open={open} onClose={onClose} maxWidth="md" fullWidth> |
| 18 | + <DialogContent sx={{ p: 0, height: 500, position: 'relative' }}> |
| 19 | + <IconButton onClick={onClose} sx={{ position: 'absolute', top: 8, right: 8, zIndex: 20 }}> |
| 20 | + <CloseIcon /> |
| 21 | + </IconButton> |
| 22 | + |
| 23 | + <Grid container sx={{ height: '100%' }}> |
| 24 | + {/* ◀ Illustration Panel */} |
| 25 | + <Grid |
| 26 | + item |
| 27 | + xs={12} |
| 28 | + md={6} |
| 29 | + sx={{ |
| 30 | + bgcolor: 'primary.main', |
| 31 | + color: '#fff', |
| 32 | + display: 'flex', |
| 33 | + alignItems: 'center', |
| 34 | + justifyContent: 'center', |
| 35 | + p: 3, |
| 36 | + }} |
| 37 | + > |
| 38 | + <Box textAlign="center"> |
| 39 | + <Typography variant="h3" gutterBottom> |
| 40 | + notangles |
| 41 | + </Typography> |
| 42 | + <Typography>timetable planner</Typography> |
| 43 | + </Box> |
| 44 | + </Grid> |
| 45 | + |
| 46 | + {/* ▶ Form Panel */} |
| 47 | + <Grid |
| 48 | + item |
| 49 | + xs={12} |
| 50 | + md={6} |
| 51 | + sx={{ |
| 52 | + display: 'flex', |
| 53 | + flexDirection: 'column', |
| 54 | + justifyContent: 'center', |
| 55 | + alignItems: 'center', |
| 56 | + p: 4, |
| 57 | + }} |
| 58 | + > |
| 59 | + {loading ? ( |
| 60 | + <> |
| 61 | + {/* Header skeletons */} |
| 62 | + <Skeleton width={180} height={32} sx={{ mb: 1 }} /> |
| 63 | + <Skeleton width={140} height={20} sx={{ mb: 3 }} /> |
| 64 | + |
| 65 | + {/* Button skeletons */} |
| 66 | + <Skeleton variant="rectangular" width="100%" height={48} sx={{ mb: 2 }} /> |
| 67 | + <Skeleton variant="rectangular" width="100%" height={48} sx={{ mb: 2 }} /> |
| 68 | + <Skeleton variant="rectangular" width="100%" height={48} sx={{ mb: 2 }} /> |
| 69 | + |
| 70 | + {/* Guest text skeleton */} |
| 71 | + <Skeleton width="60%" height={24} /> |
| 72 | + </> |
| 73 | + ) : ( |
| 74 | + <> |
| 75 | + <Typography variant="h5" gutterBottom> |
| 76 | + Welcome back |
| 77 | + </Typography> |
| 78 | + <Typography variant="body2" color="text.secondary" mb={3}> |
| 79 | + Sign in to continue |
| 80 | + </Typography> |
| 81 | + |
| 82 | + <Button fullWidth startIcon={<AccountCircleIcon />} onClick={() => onSignIn('devsoc')} sx={{ mb: 2 }}> |
| 83 | + Sign in with zID |
| 84 | + </Button> |
| 85 | + |
| 86 | + <Button fullWidth startIcon={<GoogleIcon />} onClick={() => onSignIn('google')} sx={{ mb: 2 }} disabled> |
| 87 | + Sign in with Google |
| 88 | + </Button> |
| 89 | + |
| 90 | + <Button fullWidth startIcon={<GitHubIcon />} onClick={() => onSignIn('github')} sx={{ mb: 2 }} disabled> |
| 91 | + Sign in with GitHub |
| 92 | + </Button> |
| 93 | + |
| 94 | + <Button fullWidth variant="outlined" onClick={() => onSignIn('guest')} disabled> |
| 95 | + Continue as Guest |
| 96 | + </Button> |
| 97 | + </> |
| 98 | + )} |
| 99 | + </Grid> |
| 100 | + </Grid> |
| 101 | + </DialogContent> |
| 102 | + </Dialog> |
| 103 | + ); |
| 104 | +} |
0 commit comments