Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3114 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

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