Browse Source

register page

amenpunk 3 years ago
parent
commit
a1ebd60753

+ 2 - 0
package.json

@@ -6,6 +6,8 @@
6 6
   "dependencies": {
7 7
     "@emotion/react": "^11.5.0",
8 8
     "@emotion/styled": "^11.3.0",
9
+    "@iconify/icons-eva": "^1.1.0",
10
+    "@iconify/react": "^3.1.3",
9 11
     "@mui/icons-material": "^5.1.0",
10 12
     "@mui/lab": "^5.0.0-alpha.59",
11 13
     "@mui/material": "^5.1.0",

+ 52 - 0
src/Components/Register/AuthLayout.js

@@ -0,0 +1,52 @@
1
+import PropTypes from 'prop-types';
2
+import { Link as RouterLink } from 'react-router-dom';
3
+// material
4
+import { styled } from '@mui/material/styles';
5
+import { Typography } from '@mui/material';
6
+// components
7
+import Logo  from '../../Images/logo.png'
8
+import Image from 'react-bootstrap/Image'
9
+// ----------------------------------------------------------------------
10
+
11
+const HeaderStyle = styled('header')(({ theme }) => ({
12
+    top: 0,
13
+    zIndex: 9,
14
+    lineHeight: 0,
15
+    width: '100%',
16
+    display: 'flex',
17
+    alignItems: 'center',
18
+    position: 'absolute',
19
+    padding: theme.spacing(3),
20
+    justifyContent: 'space-between',
21
+    [theme.breakpoints.up('md')]: {
22
+        alignItems: 'flex-start',
23
+        padding: theme.spacing(7, 5, 0, 7)
24
+    }
25
+}));
26
+
27
+// ----------------------------------------------------------------------
28
+
29
+AuthLayout.propTypes = {
30
+    children: PropTypes.node
31
+};
32
+
33
+export default function AuthLayout({ children }) {
34
+    return (
35
+        <HeaderStyle>
36
+            <RouterLink to="/">
37
+                <Image style={{ width : '30%'}} fluid={true} alt="register logo" src={Logo}/>
38
+            </RouterLink>
39
+
40
+            <div>
41
+                <Typography
42
+                    variant="body2"
43
+                    sx={{
44
+                        mt: { md: -2 }
45
+                    }}
46
+                >
47
+                    {children}
48
+                </Typography>
49
+            </div>
50
+        </HeaderStyle>
51
+    );
52
+}

+ 38 - 0
src/Components/Register/MHidden.js

@@ -0,0 +1,38 @@
1
+import PropTypes from 'prop-types';
2
+// material
3
+import { useMediaQuery } from '@mui/material';
4
+
5
+// ----------------------------------------------------------------------
6
+
7
+MHidden.propTypes = {
8
+    children: PropTypes.node,
9
+    width: PropTypes.oneOf([
10
+        'xsDown',
11
+        'smDown',
12
+        'mdDown',
13
+        'lgDown',
14
+        'xlDown',
15
+        'xsUp',
16
+        'smUp',
17
+        'mdUp',
18
+        'lgUp',
19
+        'xlUp'
20
+    ]).isRequired
21
+};
22
+
23
+export default function MHidden({ width, children }) {
24
+    const breakpoint = width.substring(0, 2);
25
+
26
+    const hiddenUp = useMediaQuery((theme) => theme.breakpoints.up(breakpoint));
27
+    const hiddenDown = useMediaQuery((theme) => theme.breakpoints.down(breakpoint));
28
+
29
+    if (width.includes('Down')) {
30
+        return hiddenDown ? null : children;
31
+    }
32
+
33
+    if (width.includes('Up')) {
34
+        return hiddenUp ? null : children;
35
+    }
36
+
37
+    return null;
38
+}

+ 13 - 0
src/Components/Register/Page.jsx

@@ -0,0 +1,13 @@
1
+import { forwardRef } from 'react';
2
+import { Box } from '@mui/material';
3
+
4
+// ----------------------------------------------------------------------
5
+
6
+const Page = forwardRef(({ children, title = '', ...other }, ref) => (
7
+    <Box ref={ref} {...other}>
8
+        <title>{title}</title>
9
+        {children}
10
+    </Box>
11
+));
12
+
13
+export default Page;

+ 127 - 0
src/Components/Register/RegisterForm.jsx

@@ -0,0 +1,127 @@
1
+import * as Yup from 'yup';
2
+import { useState } from 'react';
3
+import { useFormik, Form, FormikProvider } from 'formik';
4
+import { useNavigate } from 'react-router-dom';
5
+import { Icon } from '@iconify/react';
6
+// material
7
+import { Stack, TextField, IconButton, InputAdornment } from '@mui/material';
8
+import eyeFill from '@iconify/icons-eva/eye-fill';
9
+import eyeOffFill from '@iconify/icons-eva/eye-off-fill';
10
+import Button from '@mui/material/Button';
11
+
12
+// import { Visibility as eyeFill ,VisibilityOff as eyeOffFill } from '@mui/icons-material/';
13
+// ----------------------------------------------------------------------
14
+
15
+export function RegisterForm() {
16
+    const navigate = useNavigate();
17
+    const [showPassword, setShowPassword] = useState(false);
18
+
19
+    const RegisterSchema = Yup.object().shape({
20
+        firstName: Yup.string()
21
+        .min(2, 'Too Short!')
22
+        .max(50, 'Too Long!')
23
+        .required('First name required'),
24
+        lastName: Yup.string().min(2, 'Too Short!').max(50, 'Too Long!').required('Last name required'),
25
+        email: Yup.string().email('Email must be a valid email address').required('Email is required'),
26
+        password: Yup.string().required('Password is required')
27
+    });
28
+
29
+    const formik = useFormik({
30
+        initialValues: {
31
+            firstName: '',
32
+            lastName: '',
33
+            email: '',
34
+            password: ''
35
+        },
36
+        validationSchema: RegisterSchema,
37
+        onSubmit: () => {
38
+            navigate('/dashboard', { replace: true });
39
+        }
40
+    });
41
+
42
+    const { errors, touched, handleSubmit, getFieldProps } = formik;
43
+
44
+    return (
45
+        <FormikProvider value={formik}>
46
+            <Form autoComplete="off" noValidate onSubmit={handleSubmit}>
47
+                <Stack spacing={3}>
48
+                    <Stack direction={{ xs: 'column', sm: 'row' }} spacing={2}>
49
+                        <TextField
50
+                            fullWidth
51
+                            label="First name"
52
+                            {...getFieldProps('firstName')}
53
+                            error={Boolean(touched.firstName && errors.firstName)}
54
+                            helperText={touched.firstName && errors.firstName}
55
+                        />
56
+
57
+                        <TextField
58
+                            fullWidth
59
+                            label="Last name"
60
+                            {...getFieldProps('lastName')}
61
+                            error={Boolean(touched.lastName && errors.lastName)}
62
+                            helperText={touched.lastName && errors.lastName}
63
+                        />
64
+                    </Stack>
65
+
66
+                    <TextField
67
+                        fullWidth
68
+                        autoComplete="username"
69
+                        type="email"
70
+                        label="Email address"
71
+                        {...getFieldProps('email')}
72
+                        error={Boolean(touched.email && errors.email)}
73
+                        helperText={touched.email && errors.email}
74
+                    />
75
+
76
+
77
+
78
+                    <TextField
79
+                        fullWidth
80
+                        autoComplete="current-password"
81
+                        type={showPassword ? 'text' : 'password'}
82
+                        label="Password"
83
+                        {...getFieldProps('password')}
84
+                        InputProps={{
85
+                            endAdornment: (
86
+                                <InputAdornment position="end">
87
+                                    <IconButton edge="end" onClick={() => setShowPassword((prev) => !prev)}>
88
+                                        <Icon icon={showPassword ? eyeFill : eyeOffFill} />
89
+                                    </IconButton>
90
+                                </InputAdornment>
91
+                            )
92
+                        }}
93
+                        error={Boolean(touched.password && errors.password)}
94
+                        helperText={touched.password && errors.password}
95
+                    />
96
+
97
+                    <TextField
98
+                        fullWidth
99
+                        autoComplete="current-password"
100
+                        type={showPassword ? 'text' : 'password'}
101
+                        label="Password"
102
+                        {...getFieldProps('password')}
103
+                        InputProps={{
104
+                            endAdornment: (
105
+                                <InputAdornment position="end">
106
+                                    <IconButton edge="end" onClick={() => setShowPassword((prev) => !prev)}>
107
+                                        <Icon icon={showPassword ? eyeFill : eyeOffFill} />
108
+                                    </IconButton>
109
+                                </InputAdornment>
110
+                            )
111
+                        }}
112
+                        error={Boolean(touched.password && errors.password)}
113
+                        helperText={touched.password && errors.password}
114
+                    />
115
+
116
+                    <Button 
117
+                        size="large"
118
+                        style={{ backgroundColor : '#d32f2f'}}
119
+                        variant="contained" >
120
+                        Registrarme
121
+                    </Button>
122
+
123
+                </Stack>
124
+            </Form>
125
+        </FormikProvider>
126
+    );
127
+}

+ 2 - 0
src/Components/Routes.js

@@ -3,6 +3,7 @@ import { Routes, Route, Navigate } from "react-router-dom";
3 3
 
4 4
 import { Dashboard } from "./Dashboard";
5 5
 import { Login } from '../Pages/Login'
6
+import { Register } from '../Pages/Register'
6 7
 import { Home } from '../Pages/Home'
7 8
 import { Puestos } from '../Pages/Puestos'
8 9
 import { Contras  } from '../Pages/Contras'
@@ -27,6 +28,7 @@ export default function MyRoutes () {
27 28
             <Route path="/" element={<Navigate to='/login'/>} />
28 29
             <Route path="login" element={<Login/>} />
29 30
             <Route path="password/recuperar" element={<RestorePassword/>} />
31
+            <Route path="register" element={<Register/>} />
30 32
             <Route 
31 33
                 path="dashboard" 
32 34
                 element={

+ 0 - 108
src/Components/Sidebar.js

@@ -1,108 +0,0 @@
1
-import React from 'react'
2
-// import { Container, Row, Col } from 'react-bootstrap'
3
-import Logo from '../Images/logo.png';
4
-
5
-export function SideBar () {
6
-    return(
7
-        <div className="wrapper">
8
-            <nav id="sidebar">
9
-                <div className="sidebar-header">
10
-                    <div className="width_img">
11
-                        <img src={Logo} alt=""/>
12
-                    </div>
13
-                </div>
14
-                <ul className="list-unstyled components">
15
-                    <li className="cabecera_li">MENÚ</li>
16
-                    <li id="home" className="active">
17
-                        <a href="index.php"><i className="fas fa-home"></i>Inicio</a>
18
-                    </li>
19
-                    <li id="plazas">
20
-                        <a href="/"><i className="far fa-list-alt"></i>Puestos</a>
21
-                    </li>
22
-                    <li id="notificaciones">
23
-                        <a href="/"><i className="fas fa-shield-alt"></i>Contraseñas</a>
24
-                    </li>
25
-                    <li id="expedientes">
26
-                        <a href="/"><i className="far fa-user"></i>Expedientes</a>
27
-                    </li>
28
-                    <li id="resultados">
29
-                        <a href="/"><i className="fas fa-chart-line"></i>Resultados</a>
30
-                    </li>
31
-                    <li id="pruebas">
32
-                        <a href="#pageSubmenu2" data-toggle="collapse" aria-expanded="false" className="dropdown-toggle"><i className="fas fa-paperclip"></i>Pruebas</a>
33
-                        <ul className="collapse list-unstyled" id="pageSubmenu2">
34
-                            <li id="crearprueba">
35
-                                <a href="nueva-prueba.php">Crear prueba</a>
36
-                            </li>
37
-                            <li id="listado">
38
-                                <a href="pruebas.php">Listado de pruebas</a>
39
-                            </li>
40
-                            <li id="aplicar">
41
-                                <a href="asignar.php">Aplicar</a>
42
-                            </li>
43
-                            <li id="respuestas">
44
-                                <a href="/">Respuestas</a>
45
-                            </li>
46
-                            <li id="calificaciones">
47
-                                <a href="/">Calificaciones</a>
48
-                            </li>
49
-                        </ul>
50
-                    </li>
51
-                    <li id="configuraciones">
52
-                        <a href="/"><i className="fas fa-cog"></i>Configuraciones</a>
53
-                    </li>
54
-                    <li id="historial">
55
-                        <a href="/"><i className="far fa-clock"></i>Historial</a>
56
-                    </li>
57
-                    <li className="cabecera_li">EXTRAS</li>
58
-                    <li id="elementos">
59
-                        <a href="#pageSubmenu3" data-toggle="collapse" aria-expanded="false" className="dropdown-toggle"><i className="fas fa-star"></i>Elementos</a>
60
-                        <ul className="collapse list-unstyled" id="pageSubmenu3">
61
-                            <li>
62
-                                <a href="lockscreen.php" target="_blank">Pantalla Bloqueada</a>
63
-                            </li>
64
-                            <li>
65
-                                <a href="404.php" target="_blank">Error 404</a>
66
-                            </li>
67
-                            <li>
68
-                                <a href="500.php" target="_blank">Error 500</a>
69
-                            </li>
70
-                            <li>
71
-                                <a href="forgot-password.php" target="_blank">Contraseña Olvidada</a>
72
-                            </li>
73
-                        </ul>
74
-                    </li>
75
-                    <li id="tutoriales">
76
-                        <a href="#pageSubmenu4" data-toggle="collapse" aria-expanded="false" className="dropdown-toggle"><i className="far fa-bookmark"></i>Tutoriales</a>
77
-                        <ul className="collapse list-unstyled" id="pageSubmenu4">
78
-                            <li>
79
-                                <a href="/">Manual de Uso Básico</a>
80
-                            </li>
81
-                            <li>
82
-                                <a href="/">¿Qué evalúa cada test?</a>
83
-                            </li>
84
-                            <li>
85
-                                <a href="/">Ayuda General</a>
86
-                            </li>
87
-                        </ul>
88
-                    </li>
89
-                    <li id="asistencia">
90
-                        <a href="#pageSubmenu5" data-toggle="collapse" aria-expanded="false" className="dropdown-toggle"><i className="fas fa-headphones"></i>Asistencia Técnica</a>
91
-                        <ul className="collapse list-unstyled" id="pageSubmenu5">
92
-                            <li>
93
-                                <a href="/">Soporte En Línea</a>
94
-                            </li>
95
-                            <li>
96
-                                <a href="/">Soporte Por Ticket</a>
97
-                            </li>
98
-                        </ul>
99
-                    </li>
100
-                </ul>
101
-
102
-            </nav>
103
-
104
-        </div>
105
-
106
-
107
-    )
108
-}

BIN
src/Images/register_mok.png


+ 1 - 1
src/Pages/Login.jsx

@@ -180,7 +180,7 @@ export function Login() {
180 180
                                     </Link>
181 181
                                 </Grid>
182 182
                                 <Grid item>
183
-                                    <Link className="login_link" to='/'>
183
+                                    <Link className="login_link" to='/register'>
184 184
                                         {"¿No tienes cuenta? Regístrate"}
185 185
                                     </Link>
186 186
                                 </Grid>

+ 98 - 0
src/Pages/Register.jsx

@@ -0,0 +1,98 @@
1
+import * as React from 'react';
2
+import { Link as RouterLink } from 'react-router-dom';
3
+
4
+import { styled } from '@mui/material/styles';
5
+import { Box, Card, Link, Container, Typography } from '@mui/material';
6
+
7
+// import AuthLayout from '../layouts/AuthLayout';
8
+import AuthLayout from '../Components/Register/AuthLayout';
9
+
10
+import Page from '../Components/Register/Page';
11
+import { RegisterForm } from '../Components/Register/RegisterForm';
12
+// import MHidden from '../Components/Register/MHidden';
13
+
14
+import Mock from  '../Images/register_mok.png'
15
+
16
+const RootStyle = styled(Page)(({ theme }) => ({
17
+    [theme.breakpoints.up('md')]: {
18
+        display: 'flex'
19
+    }
20
+}));
21
+
22
+const SectionStyle = styled(Card)(({ theme }) => ({
23
+    width: '100%',
24
+    maxWidth: 464,
25
+    display: 'flex',
26
+    flexDirection: 'column',
27
+    justifyContent: 'center',
28
+    margin: theme.spacing(2, 0, 2, 2)
29
+}));
30
+
31
+const ContentStyle = styled('div')(({ theme }) => ({
32
+    maxWidth: 480,
33
+    margin: 'auto',
34
+    display: 'flex',
35
+    minHeight: '100vh',
36
+    flexDirection: 'column',
37
+    justifyContent: 'center',
38
+    padding: theme.spacing(12, 0)
39
+}));
40
+
41
+// ----------------------------------------------------------------------
42
+
43
+export function Register() {
44
+    return (
45
+        <RootStyle title="Register | Minimal-UI">
46
+            <AuthLayout>
47
+                Already have an account? &nbsp;
48
+                <Link underline="none" variant="subtitle2" component={RouterLink} to="/login">
49
+                    Login
50
+                </Link>
51
+            </AuthLayout>
52
+
53
+            <SectionStyle>
54
+                <Typography variant="h3" sx={{ px: 5, mt: 10, mb: 5 }}>
55
+                    Efectividad para tus procesos de reclutamiento
56
+                </Typography>
57
+                <img alt="register" src={Mock} />
58
+            </SectionStyle>
59
+
60
+            <Container>
61
+                <ContentStyle>
62
+                    <Box sx={{ mb: 5 }}>
63
+                        <Typography variant="h4" gutterBottom>
64
+                            Empieza de forma gratuita.
65
+                        </Typography>
66
+                        <Typography sx={{ color: 'text.secondary' }}>
67
+                            Gratis para siempre. No se necesita tarjeta de crédito.
68
+                        </Typography>
69
+                    </Box>
70
+
71
+
72
+                    <RegisterForm />
73
+
74
+                    <Typography variant="body2" align="center" sx={{ color: 'text.secondary', mt: 3 }}>
75
+                        By registering, I agree to Minimal&nbsp;
76
+                        <Link underline="always" sx={{ color: 'text.primary' }}>
77
+                            Terms of Service
78
+                        </Link>
79
+                        &nbsp;and&nbsp;
80
+                        <Link underline="always" sx={{ color: 'text.primary' }}>
81
+                            Privacy Policy
82
+                        </Link>
83
+                        .
84
+                    </Typography>
85
+
86
+                    <div>
87
+                        <Typography variant="subtitle2" sx={{ mt: 3, textAlign: 'center' }}>
88
+                            Already have an account?&nbsp;
89
+                            <Link to="/login" component={RouterLink}>
90
+                                Login
91
+                            </Link>
92
+                        </Typography>
93
+                    </div>
94
+                </ContentStyle>
95
+            </Container>
96
+        </RootStyle>
97
+    );
98
+}