Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 1369 | Ir a la última revisión | | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1368 stevensc 1
import React from 'react'
2
import { NavLink as Link } from 'react-router-dom'
3
import {
4
  Typography,
5
  Container,
6
  styled,
7
  emphasize,
8
  Chip,
9
  Breadcrumbs
10
} from '@mui/material'
11
 
12
import useFetch from '../../hooks/useFetch'
13
 
14
import styles from './PoliciesLayout.module.scss'
15
 
16
const StyledBreadcrumb = styled(Chip)(({ theme }) => {
17
  const backgroundColor =
18
    theme.palette.mode === 'light'
19
      ? theme.palette.grey[100]
20
      : theme.palette.grey[800]
21
 
22
  return {
23
    backgroundColor,
24
    height: theme.spacing(3),
25
    color: theme.palette.text.primary,
26
    fontWeight: theme.typography.fontWeightRegular,
27
    '&:hover, &:focus': {
28
      backgroundColor: emphasize(backgroundColor, 0.06)
29
    },
30
    '&:active': {
31
      display: 'none',
32
      boxShadow: theme.shadows[1],
33
      backgroundColor: emphasize(backgroundColor, 0.12)
34
    }
35
  }
36
})
37
 
38
const PoliciesLayout = ({ children, title }) => {
39
  return (
40
    <Container className={styles.policies__page}>
41
      <PoliciesNavigation />
42
 
43
      <Typography variant='h1'>{title}</Typography>
44
      {children}
45
    </Container>
46
  )
47
}
48
 
49
const PoliciesNavigation = () => {
50
  const { data, isLoading } = useFetch('/helpers/footer')
51
 
52
  if (isLoading) return null
53
 
54
  return (
55
    <Breadcrumbs aria-label='breadcrumb'>
56
      <StyledBreadcrumb to='/' component={Link} label='Inicio' />
57
 
58
      {Object.entries(data).map(([href, label]) => (
59
        <StyledBreadcrumb
60
          key={`${href}-${label}`}
61
          to={href}
62
          component={Link}
63
          label={label}
64
        />
65
      ))}
66
    </Breadcrumbs>
67
  )
68
}
69
 
70
export default PoliciesLayout