Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3012 | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

import React from 'react';
import { NavigateBefore } from '@mui/icons-material';
import { Box, IconButton, Typography } from '@mui/material';
import { useNavigate } from 'react-router-dom';

export default function GoBackLayout({ title, children }) {
  const navigate = useNavigate();

  const navigateBefore = () => {
    navigate(-1);
  };

  return (
    <>
      <Box
        sx={{
          display: 'flex',
          alignItems: 'center',
          gap: (theme) => theme.spacing(0.5),
          marginBottom: (theme) => theme.spacing(1),
          padding: (theme) => theme.spacing(0, 0.5)
        }}
      >
        <IconButton onClick={navigateBefore} sx={{ padding: (theme) => theme.spacing(0.3) }}>
          <NavigateBefore />
        </IconButton>

        <Typography variant='h1' sx={{ marginBottom: 0 }}>
          {title}
        </Typography>
      </Box>
      {children}
    </>
  );
}