Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev Autor Línea Nro. Línea
3114 stevensc 1
import React from 'react'
2
import { useNavigate } from 'react-router-dom'
3
import { Box, IconButton, Typography } from '@mui/material'
4
import { NavigateBefore } from '@mui/icons-material'
5
 
6
export default function PageHeader({
7
  title = '',
8
  goBack = false,
9
  action = () => null
10
}) {
11
  const navigate = useNavigate()
12
 
13
  const navigateBefore = () => navigate(-1)
14
 
15
  return (
16
    <Box
17
      sx={{
18
        display: 'flex',
19
        justifyContent: 'space-between',
20
        alignItems: 'center',
21
        gap: 2,
22
        marginBottom: 1,
23
        paddingX: 1
24
      }}
25
    >
26
      <Box
27
        sx={{
28
          display: 'flex',
29
          alignItems: 'center',
30
          gap: ({ spacing }) => spacing(0.5)
31
        }}
32
      >
33
        {goBack && (
34
          <IconButton onClick={navigateBefore}>
35
            <NavigateBefore />
36
          </IconButton>
37
        )}
38
        <Typography variant='h1'>{title}</Typography>
39
      </Box>
40
 
41
      {action()}
42
    </Box>
43
  )
44
}