Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | import { FormEvent, useCallback, useContext } from 'react'; import { useTheme } from '@mui/material/styles'; import Avatar from '@mui/material/Avatar'; import Image from 'mui-image'; import Button from '@mui/material/Button'; import TextField from '@mui/material/TextField'; import FormControlLabel from '@mui/material/FormControlLabel'; import Checkbox from '@mui/material/Checkbox'; import Link from '@mui/material/Link'; import Box from '@mui/material/Box'; import Grid from '@mui/material/Grid'; import LockOutlinedIcon from '@mui/icons-material/LockOutlined'; import Typography from '@mui/material/Typography'; import { useNavigate } from 'react-router-dom'; import { Theme, getColorModeByThemeMode, ColorModeContext } from '@/theme'; import NeumorphismPannel from '@/components/NeumorphismPannel'; import ThemeModeSwitch from '@/components/ThemeModeSwitch'; import LocaleSelector from '@/components/LocaleSelector'; import { useLocale } from '@/locales'; function Copyright(props: any) { return ( <Typography variant="body2" color="text.secondary" align="center" {...props}> {'Copyright © '} <Link color="inherit" href="https://mui.com/"> Your Website </Link>{' '} {new Date().getFullYear()}. </Typography> ); } export default function SignInSide() { const t = useLocale(); const colorMode = useContext(ColorModeContext); const theme: Theme = useTheme(); const navigate = useNavigate(); const handleSubmit = (event: FormEvent<HTMLFormElement>) => { event.preventDefault(); const data = new FormData(event.currentTarget); console.log({ email: data.get('email'), password: data.get('password') }); }; const siginIn = useCallback(() => { // navigate(menuRoutes.root.dashboard.path); colorMode.toggleColorMode(); console.log('toggleColorMode'); }, []); return ( <Grid container className="h-full flex-col justify-center" sx={[(theme: Theme) => ({ backgroundColor: theme.palette.primary[getColorModeByThemeMode({ theme })] })]} > <Grid className="w-60 absolute top-4 right-6 flex flex-row justify-between"> <LocaleSelector /> <ThemeModeSwitch /> </Grid> <NeumorphismPannel className="w-10/12 h-4/5" sx={{ margin: '0 auto' }}> <Grid className="w-full h-full flex"> <Grid className="hidden lg:flex-1 lg:flex lg:flex-col lg:justify-center lg:items-center"> <NeumorphismPannel type="pressed" sx={{ height: '80%', width: '80%' }} > <Grid sx={ [ (theme: Theme) => ({ height: '100%', width: '100%', padding: theme.spacing(2) }) ] } > <Image style={{ borderRadius: theme.neumorphism!().borderRadius }} src="https://picsum.photos/id/674/2000" height="100%" width="100%" errorIcon fit="cover" /> </Grid> </NeumorphismPannel> </Grid> <NeumorphismPannel className="flex-1 flex flex-col justify-between"> <Grid className="w-full"> <Box className="sm:mt-20" sx={{ my: 4, mx: 4, display: 'flex', flexDirection: 'column', alignItems: 'center' }} > <NeumorphismPannel type="concave"> <Avatar sx={{ m: 1, bgcolor: 'secondary.main' }}> <LockOutlinedIcon /> </Avatar> </NeumorphismPannel> <Typography component="h1" variant="h5" sx={{ mt: 1 }}> {t.loginPage.title} </Typography> <Box component="form" noValidate onSubmit={handleSubmit} sx={{ mt: 1 }}> <TextField margin="normal" required fullWidth id="email" label={t.loginPage.accountLabel} name="email" autoComplete="email" autoFocus /> <TextField margin="normal" required fullWidth name="password" label={t.loginPage.pwdLabel} type="password" id="password" autoComplete="current-password" /> <FormControlLabel control={<Checkbox value="remember" color="primary" sx={{ mr: 1 }} />} label={t.loginPage.remember} /> <Button type="submit" fullWidth variant="contained" sx={{ mt: 3, mb: 2 }} onClick={siginIn} > {t.loginPage.loginBtn} </Button> <Grid container className="sm:mt-4"> <Grid item xs> <Link href="#" variant="body2"> {t.loginPage.forgotPwd} </Link> </Grid> <Grid item> <Link href="#" variant="body2"> {t.loginPage.noAccount} </Link> </Grid> </Grid> </Box> </Box> </Grid> <Copyright sx={{ mb: 6 }} /> </NeumorphismPannel> </Grid> </NeumorphismPannel> </Grid> ); } |