Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3588 | Rev 3595 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3588 Rev 3593
Línea 1... Línea 1...
1
import React from 'react';
1
import React from 'react';
2
import { NavLink as Link, useLocation } from 'react-router-dom';
2
import { NavLink as Link, useLocation } from 'react-router-dom';
3
import { Typography, styled, Breadcrumbs } from '@mui/material';
3
import { Typography, styled, Breadcrumbs } from '@mui/material';
4
 
4
 
5
import { useFetch } from '@hooks';
5
import { useFetch } from '@hooks';
6
import colors from '@styles/colors';
6
import colors from '@styles/colors';
7
 
7
 
8
const StyledBreadcrumbs = styled(Breadcrumbs)`
8
const StyledBreadcrumbs = styled(Breadcrumbs)`
9
  li a {
9
  li a {
10
    padding: 0.3rem 1rem;
10
    padding: 0.3rem 1rem;
11
    background-color: var(--font-color);
11
    background-color: var(--font-color);
12
    color: var(--bg-color);
12
    color: var(--bg-color);
13
    border-radius: 20px;
13
    border-radius: 20px;
14
    &.active {
14
    &.active {
15
      display: none;
15
      display: none;
16
    }
16
    }
17
  }
17
  }
18
`;
18
`;
19
 
19
 
20
const StyledPoliciesPage = styled('div')`
20
const StyledPoliciesPage = styled('div')`
21
  h1 {
21
  h1 {
22
    margin-bottom: 1rem;
22
    margin-bottom: 1rem;
23
  }
23
  }
24
 
24
 
25
  h2,
25
  h2,
26
  h3,
26
  h3,
27
  h4,
27
  h4,
28
  h5,
28
  h5,
29
  h6 {
29
  h6 {
30
    margin-bottom: 0.5rem;
30
    margin-bottom: 0.5rem;
31
  }
31
  }
32
 
32
 
33
  > p {
33
  > p {
34
    margin-bottom: 0.5rem;
34
    margin-bottom: 0.5rem;
35
  }
35
  }
36
 
36
 
37
  table {
37
  table {
38
    background-color: ${colors.background.primary};
38
    background-color: ${colors.bg.primary};
39
 
39
 
40
    &,
40
    &,
41
    tr,
41
    tr,
42
    td {
42
    td {
43
      border: 1px solid ${colors.border.primary};
43
      border: 1px solid ${colors.border.primary};
44
    }
44
    }
45
 
45
 
46
    td {
46
    td {
47
      padding: 5px;
47
      padding: 5px;
48
    }
48
    }
49
  }
49
  }
50
`;
50
`;
51
 
51
 
52
const PoliciesLayout = ({ children, title }) => {
52
const PoliciesLayout = ({ children, title }) => {
53
  return (
53
  return (
54
    <>
54
    <>
55
      <PoliciesNavigation />
55
      <PoliciesNavigation />
56
      <Typography variant='h1'>{title}</Typography>
56
      <Typography variant='h1'>{title}</Typography>
57
      <StyledPoliciesPage>{children}</StyledPoliciesPage>
57
      <StyledPoliciesPage>{children}</StyledPoliciesPage>
58
    </>
58
    </>
59
  );
59
  );
60
};
60
};
61
 
61
 
62
const PoliciesNavigation = () => {
62
const PoliciesNavigation = () => {
63
  const { data, isLoading } = useFetch('/helpers/footer');
63
  const { data, isLoading } = useFetch('/helpers/footer');
64
  const { pathname } = useLocation();
64
  const { pathname } = useLocation();
65
 
65
 
66
  if (isLoading) return null;
66
  if (isLoading) return null;
67
 
67
 
68
  return (
68
  return (
69
    <StyledBreadcrumbs sx={{ my: 2 }} aria-label='breadcrumb'>
69
    <StyledBreadcrumbs sx={{ my: 2 }} aria-label='breadcrumb'>
70
      <Link exact to='/'>
70
      <Link exact to='/'>
71
        Inicio
71
        Inicio
72
      </Link>
72
      </Link>
73
 
73
 
74
      {Object.entries(data).map(([href, label]) => {
74
      {Object.entries(data).map(([href, label]) => {
75
        if (pathname.includes(href)) {
75
        if (pathname.includes(href)) {
76
          return null;
76
          return null;
77
        }
77
        }
78
 
78
 
79
        return (
79
        return (
80
          <Link key={`${href}-${label}`} to={href}>
80
          <Link key={`${href}-${label}`} to={href}>
81
            {label}
81
            {label}
82
          </Link>
82
          </Link>
83
        );
83
        );
84
      })}
84
      })}
85
    </StyledBreadcrumbs>
85
    </StyledBreadcrumbs>
86
  );
86
  );
87
};
87
};
88
 
88
 
89
export default PoliciesLayout;
89
export default PoliciesLayout;