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:
committed by
Mrugesh Mohapatra
parent
0a3a5e7a53
commit
aec4ba2035
@ -1 +0,0 @@
|
||||
export { default } from './OfflineWarning';
|
1
client/src/components/OfflineWarning/index.tsx
Normal file
1
client/src/components/OfflineWarning/index.tsx
Normal file
@ -0,0 +1 @@
|
||||
export { default } from './offline-warning';
|
@ -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;
|
Reference in New Issue
Block a user