import { IconPlus } from '@material-hu/icons/tabler';
import Stack from '@material-hu/mui/Stack/Stack';
import Typography from '@material-hu/mui/Typography/Typography';

import Button from '@material-hu/components/design-system/Buttons/Button';

import { useLokaliseTranslation } from 'src/utils/i18n';

import useCoursesTitle from '../../hooks/useCoursesTitle';

type CourseHeaderProps = {
  onCreate: () => void;
};

export const CourseHeader = ({ onCreate }: CourseHeaderProps) => {
  const { t } = useLokaliseTranslation('learning');
  const title = useCoursesTitle();

  return (
    <Stack
      sx={{
        justifyContent: 'space-between',
        alignItems: 'center',
        flexDirection: 'row',
      }}
    >
      <Typography
        variant="globalL"
        fontWeight="fontWeightSemiBold"
      >
        {title}
      </Typography>
      <Button
        variant="primary"
        startIcon={<IconPlus />}
        onClick={onCreate}
      >
        {t('course.create')}
      </Button>
    </Stack>
  );
};
