Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3741 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
3719 stevensc 1
import React from 'react';
2
import { Link, Outlet, useMatch } from 'react-router-dom';
3
import { useSelector } from 'react-redux';
3741 stevensc 4
import { AppBar, Box, Button, Container, styled, Toolbar, Typography } from '@mui/material';
3719 stevensc 5
import Slider from 'react-slick';
6
 
3741 stevensc 7
import 'slick-carousel/slick/slick.css';
8
import 'slick-carousel/slick/slick-theme.css';
9
 
3719 stevensc 10
import { parse } from '@utils';
3741 stevensc 11
import { ArrowBackIos, ArrowForwardIos } from '@mui/icons-material';
3719 stevensc 12
 
13
const Section = styled('section')(({ theme }) => ({
14
  display: 'flex',
15
  flexDirection: 'column',
16
  gap: theme.spacing(0.5),
17
  justifyContent: 'center',
18
  alignItems: 'center',
19
  flex: 1,
20
  '& > img': {
21
    display: 'block',
22
    margin: '0 auto'
23
  }
24
}));
25
 
26
const AuthPage = styled('div')(({ theme }) => ({
27
  display: 'flex',
28
  flexDirection: 'column',
29
  gap: '1rem',
3741 stevensc 30
  justifyContent: 'center',
31
  alignItems: 'center',
3742 stevensc 32
  width: '100%',
3741 stevensc 33
 
3719 stevensc 34
  [theme.breakpoints.up('md')]: {
3741 stevensc 35
    flexDirection: 'row',
36
    minHeight: 'calc(100vh - 120px)',
37
    justifyContent: 'space-between',
38
    alignItems: 'stretch'
3719 stevensc 39
  }
40
}));
41
 
42
const AuthSlider = styled(Slider)(({ theme }) => ({
3741 stevensc 43
  maxWidth: '100%',
44
  width: '100%',
45
  margin: '0 auto',
46
  marginBottom: theme.spacing(2),
47
 
48
  // Estilos para las imágenes del slider
3719 stevensc 49
  '& img': {
3741 stevensc 50
    maxWidth: '250px !important',
51
    maxHeight: '250px !important',
3719 stevensc 52
    display: 'block !important',
3741 stevensc 53
    margin: 'auto',
54
    borderRadius: '12px',
55
    objectFit: 'contain',
56
    transition: 'transform 0.3s ease',
57
 
58
    // Responsive para imágenes - iOS optimizado
59
    [theme.breakpoints.down('sm')]: {
60
      maxWidth: '200px !important',
61
      maxHeight: '200px !important'
62
    },
63
 
64
    // Para pantallas muy pequeñas de iPhone
65
    '@media (max-width: 390px)': {
66
      maxWidth: '180px !important',
67
      maxHeight: '180px !important'
68
    }
3719 stevensc 69
  },
3741 stevensc 70
 
71
  // Estilos para cada slide
72
  '& .slick-slide': {
73
    padding: '0 4px',
74
    textAlign: 'center',
75
    outline: 'none'
76
  },
77
 
78
  // Contenedor de cada slide
79
  '& .slick-slide > div': {
80
    outline: 'none',
81
    display: 'flex !important',
82
    flexDirection: 'column',
83
    alignItems: 'center',
84
    justifyContent: 'center'
85
  },
86
 
87
  // Estilos para los textos del slider
88
  '& .MuiTypography-root': {
89
    marginTop: theme.spacing(1.5),
90
    fontSize: '1rem',
91
    fontWeight: 600,
92
    color: theme.palette.text.primary,
93
    textAlign: 'center',
94
    lineHeight: 1.3,
95
    maxWidth: '250px',
96
    margin: `${theme.spacing(1.5)} auto 0`,
97
 
98
    // Responsive para textos
99
    [theme.breakpoints.down('sm')]: {
100
      fontSize: '0.95rem',
101
      marginTop: theme.spacing(1),
102
      maxWidth: '200px'
103
    },
104
 
105
    // Para pantallas muy pequeñas de iPhone
106
    '@media (max-width: 390px)': {
107
      fontSize: '0.9rem',
108
      marginTop: theme.spacing(0.5),
109
      maxWidth: '180px'
110
    }
111
  },
112
 
113
  // Estilos para los dots/puntos de navegación
114
  '& .slick-dots': {
115
    position: 'relative',
116
    bottom: 'auto',
117
    marginTop: theme.spacing(2),
118
    marginBottom: 0,
119
 
120
    '& li': {
121
      margin: '0 3px',
122
 
123
      '& button': {
124
        width: '10px',
125
        height: '10px',
126
 
127
        '&:before': {
128
          fontSize: '10px',
129
          color: theme.palette.primary.main,
130
          opacity: 0.4,
131
          width: '10px',
132
          height: '10px',
133
          lineHeight: '10px'
134
        }
135
      },
136
 
137
      '&.slick-active button:before': {
138
        opacity: 1,
139
        color: theme.palette.primary.main,
140
        transform: 'scale(1.3)'
141
      }
142
    }
143
  },
144
 
145
  // Estilos para transiciones
146
  '& .slick-track': {
147
    display: 'flex',
148
    alignItems: 'center'
149
  },
150
 
151
  // Lista del slider
152
  '& .slick-list': {
153
    overflow: 'hidden',
154
    borderRadius: '8px'
155
  },
156
 
157
  // Ocultar en pantallas medianas y grandes
3719 stevensc 158
  [theme.breakpoints.up('md')]: {
159
    display: 'none'
160
  }
161
}));
162
 
163
const AuthLayout = () => {
164
  const { logo_url, intro } = useSelector(({ auth }) => auth);
165
  const isRoot = useMatch('/');
166
 
167
  return (
168
    <>
169
      <AppBar
170
        sx={{
171
          position: 'relative',
172
          backgroundColor: 'transparent',
3741 stevensc 173
          boxShadow: 'none',
174
          zIndex: 1
3719 stevensc 175
        }}
176
      >
177
        <Container>
178
          <Toolbar
179
            sx={{
180
              minHeight: 'none',
181
              padding: 0,
182
              '& img': {
183
                display: { md: 'none' }
184
              }
185
            }}
186
          >
187
            <Link to='/'>
188
              <img src={logo_url} alt='Logo' width={50} />
189
            </Link>
190
          </Toolbar>
191
        </Container>
192
      </AppBar>
193
 
3741 stevensc 194
      <Container sx={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
3719 stevensc 195
        <AuthPage>
3741 stevensc 196
          <Section
197
            sx={{
198
              display: { xs: isRoot ? 'flex' : 'none', md: 'flex' }
199
            }}
200
          >
201
            <Box
202
              sx={{
203
                display: { xs: 'flex', md: 'none' },
204
                flexDirection: 'column',
205
                gap: '1rem',
206
                alignItems: 'center',
207
                justifyContent: 'center',
208
                width: '100%',
209
                maxWidth: '400px',
210
                padding: '1rem'
211
              }}
212
            >
213
              {isRoot && (
214
                <AuthSlider
215
                  autoplay={true}
216
                  infinite={true}
217
                  pauseOnHover={true}
218
                  pauseOnFocus={true}
219
                  dots={true}
220
                  arrows={false}
221
                  accessibility={true}
222
                  nextArrow={<ArrowForwardIos />}
223
                  prevArrow={<ArrowBackIos />}
224
                >
225
                  <Box>
226
                    <img src='/images/intro_slide_1.png' alt='image slide' />
227
                    <Typography>Desarrollate en Líder moderno</Typography>
228
                  </Box>
3719 stevensc 229
 
3741 stevensc 230
                  <Box>
231
                    <img src='/images/intro_slide_2.png' alt='image slide' />
232
                    <Typography>Evoluciona día a día</Typography>
233
                  </Box>
3719 stevensc 234
 
3741 stevensc 235
                  <Box>
236
                    <img src='/images/intro_slide_3.png' alt='image slide' />
237
                    <Typography>Construye tu futuro</Typography>
238
                  </Box>
239
                </AuthSlider>
240
              )}
3719 stevensc 241
 
3741 stevensc 242
              <Button
243
                variant='contained'
244
                color='primary'
245
                fullWidth
246
                LinkComponent={Link}
247
                to='/signin'
248
              >
249
                Iniciar sesión
250
              </Button>
251
              <Button
252
                variant='contained'
253
                color='primary'
254
                fullWidth
255
                LinkComponent={Link}
256
                to='/forgot-password'
257
              >
258
                Olvidé mi contraseña
259
              </Button>
260
            </Box>
261
 
262
            <Box
263
              sx={{
264
                display: { xs: isRoot ? 'none' : 'flex', md: 'flex' },
265
                alignItems: 'center',
266
                justifyContent: 'center',
267
                flexDirection: 'column',
268
                gap: '1rem'
269
              }}
270
            >
271
              <img src={logo_url} alt='Leaderslinked logo' />
272
              <Typography>{parse(intro)}</Typography>
273
            </Box>
3719 stevensc 274
          </Section>
275
 
3741 stevensc 276
          <Section
277
            sx={{
278
              display: { xs: isRoot ? 'none' : 'flex', md: 'flex' }
279
            }}
280
          >
3719 stevensc 281
            <Outlet />
282
          </Section>
283
        </AuthPage>
284
      </Container>
285
    </>
286
  );
287
};
288
 
289
export default AuthLayout;