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

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

type CloseEditModalProps = {
  onClose: () => void;
  onConfirm: () => void;
};

export const CloseEditModal = ({ onClose, onConfirm }: CloseEditModalProps) => {
  const { t } = useLokaliseTranslation('general');

  return (
    <Dialog
      onClose={onClose}
      title={t('unsaved_changes.title')}
      textBody={t('unsaved_changes.description')}
      secondaryButtonProps={{
        children: t('cancel'),
        onClick: onClose,
      }}
      primaryButtonProps={{
        children: t('unsaved_changes.confirm'),
        onClick: onConfirm,
      }}
    />
  );
};
