feat(client): Migrate OfflineWarning to TS (#42575)

* Rename OfflineWarning to tsx.

* Convert offline-warning to Typescript.

* Avoid using NodeJS.Timeout as type.
This commit is contained in:
Maygan Lightstone
2021-06-25 08:41:42 -06:00
committed by Mrugesh Mohapatra
parent 0a3a5e7a53
commit aec4ba2035
3 changed files with 12 additions and 9 deletions

View File

@ -1 +0,0 @@
export { default } from './OfflineWarning';

View File

@ -0,0 +1 @@
export { default } from './offline-warning';

View File

@ -1,16 +1,20 @@
import React from 'react';
import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next';
import './offline-warning.css';
const delayInMilliSeconds = 5000;
let id;
const propTypes = {
isOnline: PropTypes.bool.isRequired,
isSignedIn: PropTypes.bool.isRequired
};
function OfflineWarning({ isOnline, isSignedIn }) {
let id: ReturnType<typeof setTimeout>;
interface OfflineWarningProps {
isOnline: boolean;
isSignedIn: boolean;
}
function OfflineWarning({
isOnline,
isSignedIn
}: OfflineWarningProps): JSX.Element | null {
const { t } = useTranslation();
const [showWarning, setShowWarning] = React.useState(false);
@ -33,6 +37,5 @@ function OfflineWarning({ isOnline, isSignedIn }) {
}
OfflineWarning.displayName = 'OfflineWarning';
OfflineWarning.propTypes = propTypes;
export default OfflineWarning;