import React from 'react'; import { useTranslation } from 'react-i18next'; import { ActionGroup, Alert, Button, ButtonVariant } from '@patternfly/react-core'; import { DownloadIcon } from '@patternfly/react-icons/dist/esm/icons/download-icon'; import classNames from 'classnames'; import { Shadows, useScrollShadows, useScrollContainer } from '../../hooks'; import ButtonBar from '../button-bar/ButtonBar'; import { FormFooterProps } from './form-component-types'; import './FormFooter.scss'; const FormFooter: React.FC> = ({ handleSubmit, handleReset, handleCancel, handleDownload, submitLabel, resetLabel, cancelLabel, infoTitle, infoMessage, isSubmitting, errorMessage, successMessage, disableSubmit, hideSubmit = false, showAlert, sticky, }) => { const { t } = useTranslation(); const [scrollContainer, footerElementRef] = useScrollContainer(); const shadowPosition = useScrollShadows(sticky ? scrollContainer : null); return (
{showAlert && ( {infoMessage || t('Click {{submit}} to save changes or {{reset}} to cancel changes.', { submit: submitLabel, reset: resetLabel, })} )} {!hideSubmit && ( )} {handleReset && ( )} {handleCancel && ( )} {handleDownload && ( )}
); }; export default FormFooter;