Proyectos de Subversion LeadersLinked - SPA

Rev

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

import React from 'react';
import { Button, styled, Typography } from '@mui/material';
import Add from '@mui/icons-material/Add';

const Header = styled('div')(({ theme }) => ({
  display: 'flex',
  alignItems: 'center',
  justifyContent: 'space-between',
  position: 'relative',
  marginBottom: theme.spacing(1),
  [theme.breakpoints.up('md')]: {
    justifyContent: 'center',
    button: {
      position: 'absolute',
      right: 0,
      top: '50%',
      transform: 'translateY(-50%)'
    }
  }
}));

const TitleSection = ({ onAdd, addLabel = '', title = '', ...rest }) => {
  return (
    <Header {...rest}>
      <Typography variant='h1'>{title}</Typography>

      {onAdd && (
        <Button onClick={onAdd}>
          <Add />
          {addLabel}
        </Button>
      )}
    </Header>
  );
};

export default TitleSection;