Proyectos de Subversion LeadersLinked - SPA

Rev

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