ReconnectControls.tsx 898 B

123456789101112131415161718192021222324252627282930313233343536
  1. import React from 'react';
  2. import { useTranslation } from 'react-i18next';
  3. type Props = {
  4. isEnabled?: boolean,
  5. isProcessing?: boolean,
  6. onReconnectingRequested: () => void,
  7. }
  8. const ReconnectControls = (props: Props): JSX.Element => {
  9. const { t } = useTranslation();
  10. const { isEnabled, isProcessing } = props;
  11. return (
  12. <>
  13. <button
  14. type="submit"
  15. className={`btn ${isEnabled ? 'btn-outline-success' : 'btn-outline-secondary'}`}
  16. onClick={() => { props.onReconnectingRequested() }}
  17. disabled={!isEnabled}
  18. >
  19. { isProcessing && <i className="fa fa-spinner fa-pulse mr-2"></i> }
  20. { t('full_text_search_management.reconnect_button') }
  21. </button>
  22. <p className="form-text text-muted">
  23. { t('full_text_search_management.reconnect_description') }<br />
  24. </p>
  25. </>
  26. );
  27. };
  28. export default ReconnectControls;