|
@@ -4,7 +4,8 @@ import Button from '@mui/material/Button';
|
|
|
import { LoremIpsum } from 'react-lorem-ipsum';
|
|
|
import { Container, CssBaseline, TextField, Avatar, Typography, FormControl, FormControlLabel, Checkbox, Grid, Link } from '@mui/material';
|
|
|
import { Box } from '@mui/system';
|
|
|
-;
|
|
|
+
|
|
|
+
|
|
|
const oneCat = {
|
|
|
"_id": "62c9472cb74e1f5f2ec1a0d4",
|
|
|
"name": "iPhone",
|
|
@@ -157,79 +158,6 @@ const RangeInput = ({ min, max }) => {
|
|
|
|
|
|
}
|
|
|
///////////////////////////////////////////////////////////////////
|
|
|
-const LoginForm = ({ onLogin }) => {
|
|
|
- const [login, setLogin] = useState('');
|
|
|
- const [password, setPassword] = useState('');
|
|
|
- const isButtonActive = login?.length > 3 && password?.length > 3;
|
|
|
- return (
|
|
|
- <Container component="main" maxWidth="xs">
|
|
|
- <CssBaseline />
|
|
|
- <Box
|
|
|
- sx={{
|
|
|
- marginTop: 8,
|
|
|
- display: 'flex',
|
|
|
- flexDirection: 'column',
|
|
|
- alignItems: 'center',
|
|
|
- }}
|
|
|
- >
|
|
|
- <Avatar sx={{ m: 1, bgcolor: 'secondary.main' }}>
|
|
|
- <LockOutlinedIcon />
|
|
|
- </Avatar>
|
|
|
- <Typography component="h1" variant="h5">
|
|
|
- Sign in
|
|
|
- </Typography>
|
|
|
- <TextField
|
|
|
- fullWidth
|
|
|
- margin="normal"
|
|
|
- autoFocus
|
|
|
- required
|
|
|
- id="login-input"
|
|
|
- label="Login"
|
|
|
- size="small"
|
|
|
- defaultValue=""
|
|
|
- onChange={e => setLogin(e.target.value)}
|
|
|
- />
|
|
|
- <TextField
|
|
|
- fullWidth
|
|
|
- margin="normal"
|
|
|
- required
|
|
|
- id="password-input"
|
|
|
- label="Password"
|
|
|
- type="password"
|
|
|
- size="small"
|
|
|
- defaultValue=""
|
|
|
- onChange={e => setPassword(e.target.value)}
|
|
|
- />
|
|
|
- <FormControlLabel
|
|
|
- control={<Checkbox value="remember" color="primary" />}
|
|
|
- label="Remember me"
|
|
|
- />
|
|
|
- <Button
|
|
|
- variant="contained"
|
|
|
- sx={{ mt: 3, mb: 2 }}
|
|
|
- fullWidth
|
|
|
- type="submit"
|
|
|
- disabled={!isButtonActive}
|
|
|
- onClick={() => { onLogin({ login, password }) }}>
|
|
|
- Login...
|
|
|
- </Button>
|
|
|
- <Grid container>
|
|
|
- <Grid item xs>
|
|
|
- <Link href="#" variant='body2'>
|
|
|
- Forgot password?
|
|
|
- </Link>
|
|
|
- </Grid>
|
|
|
- <Grid item>
|
|
|
- <Link href="#" variant='body2'>
|
|
|
- {"Don't have an account? Sign Up"}
|
|
|
- </Link>
|
|
|
- </Grid>
|
|
|
- </Grid>
|
|
|
- </Box>
|
|
|
-
|
|
|
- </Container>
|
|
|
- )
|
|
|
-}
|
|
|
function hasNumber(str) {
|
|
|
return /\d/.test(str);
|
|
|
}
|
|
@@ -284,10 +212,6 @@ export function ManualReact() {
|
|
|
{/*
|
|
|
<RangeInput min={2} max={10} />
|
|
|
<PasswordConfirm />
|
|
|
- */}
|
|
|
- <LoginForm />
|
|
|
-
|
|
|
- {/*
|
|
|
{show && <div>Вуаля</div>}
|
|
|
<ul>
|
|
|
{names.map(name => <Name name={name}/>)}
|