Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 1368 | Rev 1370 | Ir a la última revisión | | Comparar con el anterior | 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 }) => {
1369 stevensc 17
  const backgroundColor = theme.palette.text.primary
1368 stevensc 18
 
19
  return {
20
    backgroundColor,
21
    height: theme.spacing(3),
1369 stevensc 22
    color: theme.palette.background.default,
1368 stevensc 23
    fontWeight: theme.typography.fontWeightRegular,
24
    '&:hover, &:focus': {
25
      backgroundColor: emphasize(backgroundColor, 0.06)
26
    },
27
    '&:active': {
1369 stevensc 28
      display: 'none'
1368 stevensc 29
    }
30
  }
31
})
32
 
33
const PoliciesLayout = ({ children, title }) => {
34
  return (
35
    <Container className={styles.policies__page}>
36
      <PoliciesNavigation />
37
 
38
      <Typography variant='h1'>{title}</Typography>
39
      {children}
40
    </Container>
41
  )
42
}
43
 
44
const PoliciesNavigation = () => {
45
  const { data, isLoading } = useFetch('/helpers/footer')
46
 
47
  if (isLoading) return null
48
 
49
  return (
50
    <Breadcrumbs aria-label='breadcrumb'>
51
      <StyledBreadcrumb to='/' component={Link} label='Inicio' />
52
 
53
      {Object.entries(data).map(([href, label]) => (
54
        <StyledBreadcrumb
55
          key={`${href}-${label}`}
56
          to={href}
57
          component={Link}
58
          label={label}
59
        />
60
      ))}
61
    </Breadcrumbs>
62
  )
63
}
64
 
65
export default PoliciesLayout