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

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

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

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

  return (
    <HuDialog
      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,
      }}
    />
  );
};

export default CloseEditModal;
