Rev 3462 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
import React from 'react';
import { useNavigate } from 'react-router-dom';
import { Typography, Button, Box, IconButton } from '@mui/material';
import { Add, NavigateBefore } from '@mui/icons-material';
export function PageHeader({ title = '', labelAdd = 'Agregar', goBack = false, onAdd }) {
const navigate = useNavigate();
return (
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
{goBack && (
<IconButton onClick={() => navigate(-1)}>
<NavigateBefore />
</IconButton>
)}
<Typography variant='h1'>{title}</Typography>
</Box>
{onAdd && (
<Button variant='contained' startIcon={<Add />} onClick={onAdd}>
{labelAdd}
</Button>
)}
</Box>
);
}